Coverage Report

Created: 2017-11-12 13:27

/home/liu/buildslave/linux-x64-runtests/build/lib/nnc/cmd/relu/ccv_nnc_relu.c
Line
Count
Source (jump to first uncovered line)
1
#include <ccv.h>
2
#include <nnc/ccv_nnc.h>
3
#include <nnc/ccv_nnc_internal.h>
4
5
static int _ccv_nnc_relu_forw_bitmask(const uint64_t* const input_bitmasks, const int input_bitmask_size, const uint64_t* const output_bitmasks, const int output_bitmask_size)
6
75
{
7
75
  if (
(input_bitmasks[0] & 1u) == 1u && 75
output_bitmasks[0] == 1u75
)
8
75
    return 1;
9
0
  return 0;
10
75
}
11
12
static int _ccv_nnc_relu_back_bitmask(const uint64_t* const input_bitmasks, const int input_bitmask_size, const uint64_t* const output_bitmasks, const int output_bitmask_size)
13
52
{
14
52
  if (
(input_bitmasks[0] & 3u) == ((1u << 0) | (1u << 1)) && 52
output_bitmasks[0] == 1u20
)
15
20
    return 1;
16
32
  return 0;
17
52
}
18
19
REGISTER_COMMAND(CCV_NNC_RELU_FORWARD)(ccv_nnc_cmd_registry_t* const registry)
20
  FIND_BACKEND(ccv_nnc_relu_cpu_ref.c)
21
1
{
22
1
  registry->flags = CCV_NNC_CMD_ATTR_INPLACE;
23
1
  registry->bitmask = _ccv_nnc_relu_forw_bitmask;
24
1
  registry->tensor_auto = ccv_nnc_hint_tensor_auto_forward_from_inputs;
25
1
}
26
27
REGISTER_COMMAND(CCV_NNC_RELU_BACKWARD)(ccv_nnc_cmd_registry_t* const registry)
28
  FIND_BACKEND(ccv_nnc_relu_cpu_ref.c)
29
1
{
30
1
  registry->flags = CCV_NNC_CMD_ATTR_INPLACE;
31
1
  registry->bitmask = _ccv_nnc_relu_back_bitmask;
32
1
  registry->tensor_auto = ccv_nnc_hint_tensor_auto_backward_from_gradient;
33
1
}