## Coverage Report

#### Created: 2026-04-14 19:22

next uncovered line (L), next uncovered region (R), next uncovered branch (B)

    /home/liu/actions-runner/_work/ccv/ccv/lib/nnc/cmd/grid_sample/ccv_nnc_grid_sample.c

    Line
    Count
    Source
    1
    #include "ccv.h"
    2
    #include "nnc/ccv_nnc.h"
    3
    #include "nnc/ccv_nnc_internal.h"
    4
    5
    static int _ccv_nnc_grid_sample_forw_bitmask(const ccv_nnc_cmd_param_t cmd, const int input_size, const int output_size, const uint64_t* const input_bitmasks, const int input_bitmask_size, const uint64_t* const output_bitmasks, const int output_bitmask_size)
    6
    0
    {
    7
    0
      if ((input_bitmasks[0] & 3u) == 3u && output_bitmasks[0] == 1u)
    8
    0
        return 1;
    9
    0
      return 0;
    10
    0
    }
    11
    12
    static int _ccv_nnc_grid_sample_back_bitmask(const ccv_nnc_cmd_param_t cmd, const int input_size, const int output_size, const uint64_t* const input_bitmasks, const int input_bitmask_size, const uint64_t* const output_bitmasks, const int output_bitmask_size)
    13
    0
    {
    14
    0
      if ((input_bitmasks[0] & 5u) == ((1u << 0) | (1u << 2)) && output_bitmasks[0] == 1u)
    15
    0
        return 1;
    16
    0
      return 0;
    17
    0
    }
    18
    19
    REGISTER_COMMAND(CCV_NNC_GRID_SAMPLE_FORWARD)(ccv_nnc_cmd_registry_t* const registry)
    20
      FIND_BACKEND(ccv_nnc_grid_sample_cpu_ref.c, gpu/ccv_nnc_grid_sample_gpu_cudnn.cu, mps/ccv_nnc_grid_sample_mps.m)
    21
    1
    {
    22
    1
      registry->bitmask = _ccv_nnc_grid_sample_forw_bitmask;
    23
    1
      registry->tensor_auto = ccv_nnc_hint_tensor_auto_forward_from_inputs;
    24
    1
    }
    25
    26
    REGISTER_COMMAND(CCV_NNC_GRID_SAMPLE_BACKWARD)(ccv_nnc_cmd_registry_t* const registry)
    27
      FIND_BACKEND(ccv_nnc_grid_sample_cpu_ref.c, gpu/ccv_nnc_grid_sample_gpu_cudnn.cu)
    28
    1
    {
    29
    1
      registry->bitmask = _ccv_nnc_grid_sample_back_bitmask;
    30
    1
      registry->tensor_auto = ccv_nnc_hint_tensor_auto_backward_from_gradient;
    31
    1
    }
    32
    33
    //@REGISTER_EASY_COMMAND_MACRO(CCV_NNC_GRID_SAMPLE_FORWARD)
    34
    #define CMD_GRID_SAMPLE_FORWARD(_align_corners) ccv_nnc_cmd(CCV_NNC_GRID_SAMPLE_FORWARD, 0, ((ccv_nnc_cmd_param_t){.size={.dim={1,1,1}},.grid_sample={.align_corners=(_align_corners)}}), 0)
    35
    //@REGISTER_EASY_COMMAND_MACRO(CCV_NNC_GRID_SAMPLE_BACKWARD)
    36
    #define CMD_GRID_SAMPLE_BACKWARD(_align_corners) ccv_nnc_cmd(CCV_NNC_GRID_SAMPLE_BACKWARD, 0, ((ccv_nnc_cmd_param_t){.size={.dim={1,1,1}},.grid_sample={.align_corners=(_align_corners)}}), 0)