| 65 | typename std::enable_if<validation::is_floating_point<T>::value && validation::is_floating_point<TB>::value, |
| 66 | int>::type = 0> |
| 67 | T calculate_conv3d(const SimpleTensor<T> &src, |
| 68 | const SimpleTensor<T> &weights, |
| 69 | const SimpleTensor<TB> &bias, |
| 70 | const Size3D &dilation, |
| 71 | int batch, |
| 72 | int z_start, |
| 73 | int y_start, |
| 74 | int x_start, |
| 75 | int ch_out, |
| 76 | UniformQuantizationInfo oq_info) |
| 77 | { |
| 78 | ARM_COMPUTE_UNUSED(oq_info); |
| 79 | |
| 80 | const unsigned int weights_width = weights.shape()[weights_width_dim]; |
| 81 | const unsigned int weights_height = weights.shape()[weights_height_dim]; |
| 82 | const unsigned int weights_depth = weights.shape()[weights_depth_dim]; |
| 83 | |
| 84 | const unsigned int src_channels = src.shape()[channel_dim]; |
| 85 | const unsigned int src_width = src.shape()[width_dim]; |
| 86 | const unsigned int src_height = src.shape()[height_dim]; |
| 87 | const unsigned int src_depth = src.shape()[depth_dim]; |
| 88 | |
| 89 | TACC total(0); |
| 90 | for (unsigned int weight_d = 0; weight_d < weights_depth; ++weight_d) |
| 91 | { |
| 92 | const int idx_z = z_start + dilation.depth * weight_d; |
| 93 | for (unsigned int weight_y = 0; weight_y < weights_height; ++weight_y) |
| 94 | { |
| 95 | const int idx_y = y_start + dilation.height * weight_y; |
| 96 | for (unsigned int weight_x = 0; weight_x < weights_width; ++weight_x) |
| 97 | { |
| 98 | const int idx_x = x_start + dilation.width * weight_x; |
| 99 | |
| 100 | //Check if the point is within padding |
| 101 | const bool is_x_valid = is_valid_pixel(idx_x, 0, src_width); |
| 102 | const bool is_y_valid = is_valid_pixel(idx_y, 0, src_height); |
| 103 | const bool is_z_valid = is_valid_pixel(idx_z, 0, src_depth); |
| 104 | const bool is_invalid_pixel = !(is_x_valid && is_y_valid && is_z_valid); |
| 105 | if (is_invalid_pixel) |
| 106 | { |
| 107 | continue; |
| 108 | } |
| 109 | |
| 110 | for (unsigned int ch_in = 0; ch_in < src_channels; ++ch_in) |
| 111 | { |
| 112 | const T *in_ptr = src.data(); |
| 113 | const T *w_ptr = weights.data(); |
| 114 | |
| 115 | const int in_offset = coord2index(src.shape(), Coordinates{ch_in, idx_x, idx_y, idx_z, batch}); |
| 116 | const int weight_offset = |
| 117 | coord2index(weights.shape(), Coordinates{ch_out, ch_in, weight_x, weight_y, weight_d}); |
| 118 | T input_value = in_ptr[in_offset]; |
| 119 | T weight_value = w_ptr[weight_offset]; |
| 120 | total += (input_value * weight_value); |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 | } |
nothing calls this directly
no test coverage detected