| 812 | } |
| 813 | |
| 814 | void Compute(OpKernelContext* context) override { |
| 815 | const Tensor& tensor_in = context->input(0); |
| 816 | |
| 817 | PoolParameters params{context, ksize_, stride_, |
| 818 | padding_, data_format_, tensor_in.shape()}; |
| 819 | if (!context->status().ok()) { |
| 820 | return; |
| 821 | } |
| 822 | |
| 823 | TensorShape out_shape({params.tensor_in_batch, params.out_height, |
| 824 | params.out_width, params.depth}); |
| 825 | Tensor* output = nullptr; |
| 826 | OP_REQUIRES_OK(context, context->allocate_output(0, out_shape, &output)); |
| 827 | |
| 828 | LaunchMaxPoolingNoMask<Device, T>::launch(context, params, tensor_in, |
| 829 | output); |
| 830 | } |
| 831 | |
| 832 | private: |
| 833 | std::vector<int32> ksize_; |