| 5 | namespace cuda { |
| 6 | |
| 7 | void FakeQuantForwardImpl::exec( |
| 8 | _megdnn_tensor_in input, _megdnn_tensor_in scale, _megdnn_tensor_in zero_point, |
| 9 | _megdnn_tensor_out output, _megdnn_workspace workspace) { |
| 10 | check_exec( |
| 11 | input.layout, scale.layout, zero_point.layout, output.layout, |
| 12 | workspace.size); |
| 13 | |
| 14 | if (!input.layout.is_contiguous() || !output.layout.is_contiguous()) { |
| 15 | return exec_noncontig(input, scale, zero_point, output); |
| 16 | } |
| 17 | ElemwiseOpParamN<2> ele_param; |
| 18 | ele_param[0] = scale; |
| 19 | ele_param[0].layout = ele_param[0].layout.broadcast(input.layout); |
| 20 | ele_param[1] = zero_point; |
| 21 | ele_param[1].layout = ele_param[1].layout.broadcast(input.layout); |
| 22 | ele_param.init_from_given_tensor(); |
| 23 | auto stream = cuda_stream(handle()); |
| 24 | |
| 25 | #define cb(DType) \ |
| 26 | if (input.layout.dtype == DType()) { \ |
| 27 | using T = typename DTypeTrait<DType>::ctype; \ |
| 28 | run_elemwise<FakeQuantKernOp<T>, T, 2>( \ |
| 29 | ele_param, stream, {input, output, m_param}); \ |
| 30 | return; \ |
| 31 | } |
| 32 | cb(megdnn::dtype::Float32) |
| 33 | #undef cb |
| 34 | } |
| 35 | |
| 36 | void FakeQuantForwardImpl::exec_noncontig( |
| 37 | _megdnn_tensor_in input, _megdnn_tensor_in scale, _megdnn_tensor_in zero_point, |
nothing calls this directly
no test coverage detected