| 13 | } |
| 14 | |
| 15 | void BNForward::check_exec( |
| 16 | const TensorLayout& src, const TensorLayout& bn_scale, |
| 17 | const TensorLayout& bn_bias, const TensorLayout& mean, |
| 18 | const TensorLayout& variance, const TensorLayout& batch_mean, |
| 19 | const TensorLayout& batch_inv_variance, const TensorLayout& dst, |
| 20 | size_t workspace_in_bytes, size_t reserve_in_bytes) { |
| 21 | // moving some python assert to dnn to decrease the assert overhead |
| 22 | megdnn_assert( |
| 23 | src.ndim == 4, |
| 24 | "ndim of the input tensor for batch_norm should be 4, but you give %zu", |
| 25 | src.ndim); |
| 26 | megdnn_assert(bn_scale.ndim == 4, "expect 4, get %zu\n", bn_scale.ndim); |
| 27 | megdnn_assert(bn_bias.ndim == 4, "expect 4, get %zu\n", bn_bias.ndim); |
| 28 | megdnn_assert_eq_layout(bn_scale, bn_bias); |
| 29 | megdnn_assert_eq_layout(batch_mean, batch_inv_variance); |
| 30 | |
| 31 | megdnn_assert_contiguous(src); |
| 32 | megdnn_assert_eq_layout(src, dst); |
| 33 | megdnn_assert_eq_layout(bn_scale, bn_bias); |
| 34 | |
| 35 | megdnn_assert(src.dtype.category() == DTypeCategory::FLOAT); |
| 36 | megdnn_assert(bn_scale.dtype.category() == DTypeCategory::FLOAT); |
| 37 | auto required_workspace_in_bytes = get_workspace_in_bytes( |
| 38 | src, bn_scale, bn_bias, mean, variance, batch_mean, batch_inv_variance, {}, |
| 39 | dst); |
| 40 | megdnn_assert(workspace_in_bytes >= required_workspace_in_bytes); |
| 41 | auto required_reserve_in_bytes = get_reserve_in_bytes(src); |
| 42 | megdnn_assert(reserve_in_bytes >= required_reserve_in_bytes); |
| 43 | } |
| 44 | |
| 45 | void BNBackward::check_exec( |
| 46 | const TensorLayout& x, const TensorLayout& dy, |
nothing calls this directly
no test coverage detected