MCPcopy Create free account
hub / github.com/EnyaHermite/PicassoPlus / MaxPool3dGrad

Function MaxPool3dGrad

picasso/point/pi_modules/source/pcloud_pool3d.cpp:57–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55
56
57torch::Tensor MaxPool3dGrad(
58 torch::Tensor grad_output, // gradient of pooled features: concat_Mp * in_channels
59 torch::Tensor input, // input features: concat_Np * in_channels
60 torch::Tensor max_index) // the neighbor gives maximum activation: concat_Mp * in_channels
61{
62 CHECK_INPUT(input,2);
63 CHECK_INPUT(grad_output,2);
64 CHECK_INPUT(max_index,2);
65
66 // get the dims required by computations
67 int Np = input.size(0); // number of input points
68 int C = input.size(1); // number of input channels
69 int Mp = grad_output.size(0); // number of output points
70
71 TORCH_CHECK(max_index.dim()==2, "rank of max_index should be 2, i.e. (Mp, in_channels)");
72
73 // get the c++ pointers to the input tensors
74 const float* gradOut_ptr = grad_output.data_ptr<float>();
75 const int* maxIndex_ptr = max_index.data_ptr<int32_t>();
76
77 // create an output tensor
78 auto grad_input = torch::zeros({Np,C}, input.options());
79 float* gradIn_ptr = grad_input.data_ptr<float>();
80
81 maxPool3dGradLauncher(Np, Mp, C, maxIndex_ptr, gradOut_ptr, gradIn_ptr);
82 return grad_input;
83}
84
85
86torch::Tensor AvgPool3d(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected