| 15 | namespace test { |
| 16 | |
| 17 | TEST_F(FALLBACK, CONV_BIAS_FORWARD) { |
| 18 | using namespace conv_bias; |
| 19 | std::vector<TestArg> args = get_args(); |
| 20 | Checker<ConvBiasForward> checker(handle()); |
| 21 | NormalRNG default_rng; |
| 22 | UniformIntRNG int_rng{-50, 50}; |
| 23 | param::ConvBias param; |
| 24 | { |
| 25 | param.format = param::ConvBias::Format::NHWC; |
| 26 | auto src_shape = TensorShape{2, 16, 32, 24}; |
| 27 | auto filter_shape = TensorShape{4, 3, 3, 24}; |
| 28 | auto bias_shape_channel = TensorShape{1, 1, 1, 4}; |
| 29 | checker.set_dtype(0, dtype::Float32()) |
| 30 | .set_dtype(1, dtype::Float32()) |
| 31 | .set_dtype(2, dtype::Float32()) |
| 32 | .set_rng(0, &default_rng) |
| 33 | .set_rng(1, &default_rng) |
| 34 | .set_rng(2, &default_rng) |
| 35 | .set_param(param) |
| 36 | .execs({src_shape, filter_shape, bias_shape_channel, {}, {}}); |
| 37 | } |
| 38 | checker.set_before_exec_callback( |
| 39 | conv_bias::ConvBiasAlgoChecker<ConvBias>("FALLBACK_NAIVE")); |
| 40 | for (auto&& arg : args) { |
| 41 | checker.set_dtype(0, dtype::Float32()) |
| 42 | .set_dtype(1, dtype::Float32()) |
| 43 | .set_dtype(2, dtype::Float32()) |
| 44 | .set_rng(0, &default_rng) |
| 45 | .set_rng(1, &default_rng) |
| 46 | .set_rng(2, &default_rng) |
| 47 | .set_epsilon(1e-3) |
| 48 | .set_param(arg.param) |
| 49 | .execs({arg.src, arg.filter, arg.bias, {}, {}}); |
| 50 | } |
| 51 | { |
| 52 | param.format = param::ConvBias::Format::NCHW; |
| 53 | param.sparse = ConvBias::Param::Sparse::GROUP; |
| 54 | auto src_shape = TensorShape{2, 16, 32, 24}; |
| 55 | auto filter_shape = TensorShape{4, 4, 4, 1, 1}; |
| 56 | auto bias_shape_channel = TensorShape{1, 16, 1, 1}; |
| 57 | auto bias_shape = TensorShape{2, 16, 32, 24}; |
| 58 | checker.set_dtype(0, dtype::Float32()) |
| 59 | .set_dtype(1, dtype::Float32()) |
| 60 | .set_dtype(2, dtype::Float32()) |
| 61 | .set_rng(0, &default_rng) |
| 62 | .set_rng(1, &default_rng) |
| 63 | .set_rng(2, &default_rng) |
| 64 | .set_param(param) |
| 65 | .execs({src_shape, filter_shape, bias_shape, {}, {}}) |
| 66 | .execs({src_shape, filter_shape, bias_shape_channel, {}, {}}); |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | TEST_F(FALLBACK, CONV_BIAS_FORWARD_RECORD) { |
| 71 | using namespace conv_bias; |
nothing calls this directly
no test coverage detected