| 61 | |
| 62 | private: |
| 63 | void Compute(KernelComputeContext* ctx) const override { |
| 64 | const Tensor* input = ctx->Tensor4ArgNameAndIndex("x", 0); |
| 65 | Tensor* output = ctx->Tensor4ArgNameAndIndex("y", 0); |
| 66 | |
| 67 | const std::vector<int32_t> output_size = ctx->Attr<std::vector<int32_t>>("output_size"); |
| 68 | const std::vector<int32_t> kernel_size = ctx->Attr<std::vector<int32_t>>("kernel_size"); |
| 69 | const std::vector<int32_t> dilation = ctx->Attr<std::vector<int32_t>>("dilation_rate"); |
| 70 | const std::vector<int32_t> padding = ctx->Attr<std::vector<int32_t>>("padding"); |
| 71 | const std::vector<int32_t> stride = ctx->Attr<std::vector<int32_t>>("strides"); |
| 72 | |
| 73 | const auto& state_ptr = CreateFoldOpKernelState<INDEX_T, NDIM, SDIM>( |
| 74 | input->shape_view(), output_size, kernel_size, padding, stride, dilation); |
| 75 | const FoldParams<INDEX_T, NDIM, SDIM> params = state_ptr->params(); |
| 76 | size_t out_bytes_size = |
| 77 | output->shape_view().elem_cnt() * GetSizeOfDataType(output->data_type()); |
| 78 | Memset<device_type>(ctx->stream(), output->mut_dptr<T>(), 0, out_bytes_size); |
| 79 | FoldKernelUtil<device_type, T, INDEX_T, NDIM, SDIM>::Forward( |
| 80 | ctx->stream(), ¶ms, input->dptr<T>(), output->mut_dptr<T>()); |
| 81 | } |
| 82 | |
| 83 | bool AlwaysComputeWhenAllOutputsEmpty() const override { return false; } |
| 84 | }; |
nothing calls this directly
no test coverage detected