| 29 | }; |
| 30 | |
| 31 | std::shared_ptr<PoolOpKernelCache> InitPoolOpKernelCache(user_op::KernelCacheContext* ctx, |
| 32 | const int32_t& dim) { |
| 33 | const Shape& x_shape = ctx->TensorDesc4ArgNameAndIndex("x", 0)->shape(); |
| 34 | const std::string& data_format = ctx->Attr<std::string>("data_format"); |
| 35 | const std::string& padding = ctx->Attr<std::string>("padding"); |
| 36 | const auto& padding_before = ctx->Attr<std::vector<int32_t>>("padding_before"); |
| 37 | const auto& padding_after = ctx->Attr<std::vector<int32_t>>("padding_after"); |
| 38 | const std::vector<int32_t>& pool_size = ctx->Attr<std::vector<int32_t>>("pool_size"); |
| 39 | const std::vector<int32_t>& strides = ctx->Attr<std::vector<int32_t>>("strides"); |
| 40 | const bool ceil_mode = ctx->Attr<bool>("ceil_mode"); |
| 41 | Params3D params_3d = Params3D(dim, x_shape, data_format, padding, padding_before, padding_after, |
| 42 | pool_size, strides, ceil_mode); |
| 43 | std::shared_ptr<PoolOpKernelCache> state(new PoolOpKernelCache(params_3d)); |
| 44 | return state; |
| 45 | } |
| 46 | |
| 47 | template<typename T> |
| 48 | struct PoolCpuKernelUtil { |
no test coverage detected