mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-08-01 03:12:49 +08:00
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
This commit is contained in:
parent
9437768687
commit
7d8b029aae
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user