| 953 | } |
| 954 | |
| 955 | void Compute(OpKernelContext* context) override { |
| 956 | const Tensor& tensor_in = context->input(0); |
| 957 | OP_REQUIRES(context, tensor_in.dims() == 4, |
| 958 | errors::InvalidArgument("tensor_in must be 4-dimensional (2)")); |
| 959 | OP_REQUIRES(context, tensor_in.NumElements() > 0, |
| 960 | errors::InvalidArgument("tensor_in must not be empty (2)")); |
| 961 | |
| 962 | PoolParameters params{context, ksize_, stride_, |
| 963 | padding_, FORMAT_NHWC, tensor_in.shape()}; |
| 964 | if (!context->status().ok()) { |
| 965 | return; |
| 966 | } |
| 967 | |
| 968 | TensorShape out_shape({params.tensor_in_batch, params.out_height, |
| 969 | params.out_width, params.depth}); |
| 970 | Tensor* output = nullptr; |
| 971 | OP_REQUIRES_OK(context, context->allocate_output(0, out_shape, &output)); |
| 972 | Tensor* argmax = nullptr; |
| 973 | OP_REQUIRES_OK(context, context->allocate_output(1, out_shape, &argmax)); |
| 974 | |
| 975 | LaunchMaxPoolingWithArgmax<Device, T>::launch( |
| 976 | context, params, tensor_in, output, argmax, propagate_nans_, |
| 977 | include_batch_in_index_); |
| 978 | } |
| 979 | |
| 980 | private: |
| 981 | std::vector<int32> ksize_; |
nothing calls this directly
no test coverage detected