Commit 7d8b029a authored by Jeremy Reizenstein's avatar Jeremy Reizenstein Committed by Facebook GitHub Bot
Browse files

increment_version for inplace ops

Summary: For safety checks, make inplace forward operations in cuda and c++ call increment_version.

Reviewed By: davidsonic

Differential Revision: D44302504

fbshipit-source-id: 6ff62251e352d6778cb54399e2e11459e16e77ba
parent 94377686
......@@ -7,6 +7,7 @@
*/
#pragma once
#include <torch/csrc/autograd/VariableTypeUtils.h>
#include <torch/extension.h>
#include <cstdio>
#include <tuple>
......@@ -96,6 +97,8 @@ inline void PointsToVolumesForward(
point_weight,
align_corners,
splat);
torch::autograd::increment_version(volume_features);
torch::autograd::increment_version(volume_densities);
return;
#else
AT_ERROR("Not compiled with GPU support.");
......
......@@ -6,6 +6,7 @@
* LICENSE file in the root directory of this source tree.
*/
#include <torch/csrc/autograd/VariableTypeUtils.h>
#include <torch/extension.h>
#include <algorithm>
#include <cmath>
......@@ -148,6 +149,8 @@ void PointsToVolumesForwardCpu(
}
}
}
torch::autograd::increment_version(volume_features);
torch::autograd::increment_version(volume_densities);
}
// With nearest, the only smooth dependence is that volume features
......
......@@ -7,6 +7,7 @@
*/
#pragma once
#include <torch/csrc/autograd/VariableTypeUtils.h>
#include <torch/extension.h>
#include <cstdio>
#include <tuple>
......@@ -63,6 +64,7 @@ inline void SamplePdf(
#ifdef WITH_CUDA
CHECK_CUDA(weights);
CHECK_CONTIGUOUS_CUDA(outputs);
torch::autograd::increment_version(outputs);
SamplePdfCuda(bins, weights, outputs, eps);
return;
#else
......
......@@ -6,6 +6,7 @@
* LICENSE file in the root directory of this source tree.
*/
#include <torch/csrc/autograd/VariableTypeUtils.h>
#include <torch/extension.h>
#include <algorithm>
#include <thread>
......@@ -137,4 +138,5 @@ void SamplePdfCpu(
for (auto&& thread : threads) {
thread.join();
}
torch::autograd::increment_version(outputs);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment