MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Compute

Method Compute

tensorflow/core/kernels/maxpooling_op.cc:955–978  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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_;

Callers

nothing calls this directly

Calls 9

InvalidArgumentFunction · 0.85
launchFunction · 0.85
allocate_outputMethod · 0.80
inputMethod · 0.45
dimsMethod · 0.45
NumElementsMethod · 0.45
shapeMethod · 0.45
okMethod · 0.45
statusMethod · 0.45

Tested by

no test coverage detected