diff --git a/pytorch3d/csrc/points_to_volumes/points_to_volumes.h b/pytorch3d/csrc/points_to_volumes/points_to_volumes.h index 9b0770669..4c5eba3c9 100644 --- a/pytorch3d/csrc/points_to_volumes/points_to_volumes.h +++ b/pytorch3d/csrc/points_to_volumes/points_to_volumes.h @@ -7,6 +7,7 @@ */ #pragma once +#include #include #include #include @@ -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."); diff --git a/pytorch3d/csrc/points_to_volumes/points_to_volumes_cpu.cpp b/pytorch3d/csrc/points_to_volumes/points_to_volumes_cpu.cpp index ac7a3d989..900ea097a 100644 --- a/pytorch3d/csrc/points_to_volumes/points_to_volumes_cpu.cpp +++ b/pytorch3d/csrc/points_to_volumes/points_to_volumes_cpu.cpp @@ -6,6 +6,7 @@ * LICENSE file in the root directory of this source tree. */ +#include #include #include #include @@ -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 diff --git a/pytorch3d/csrc/sample_pdf/sample_pdf.h b/pytorch3d/csrc/sample_pdf/sample_pdf.h index 66775c4fc..899117df7 100644 --- a/pytorch3d/csrc/sample_pdf/sample_pdf.h +++ b/pytorch3d/csrc/sample_pdf/sample_pdf.h @@ -7,6 +7,7 @@ */ #pragma once +#include #include #include #include @@ -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 diff --git a/pytorch3d/csrc/sample_pdf/sample_pdf_cpu.cpp b/pytorch3d/csrc/sample_pdf/sample_pdf_cpu.cpp index b297ae9e5..272197c6e 100644 --- a/pytorch3d/csrc/sample_pdf/sample_pdf_cpu.cpp +++ b/pytorch3d/csrc/sample_pdf/sample_pdf_cpu.cpp @@ -6,6 +6,7 @@ * LICENSE file in the root directory of this source tree. */ +#include #include #include #include @@ -137,4 +138,5 @@ void SamplePdfCpu( for (auto&& thread : threads) { thread.join(); } + torch::autograd::increment_version(outputs); }