Skip to content

Commit 927f6b6

Browse files
authored
Merge pull request #43 from pfxuan/empty-cache
Reduce VRAM consumption
2 parents 819fae4 + adb9b25 commit 927f6b6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

model.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
#include "rasterize_gaussians.hpp"
66
#include "tensor_math.hpp"
77
#include "vendor/gsplat/config.h"
8+
#ifdef USE_HIP
9+
#include <c10/hip/HIPCachingAllocator.h>
10+
#else
11+
#include <c10/cuda/CUDACachingAllocator.h>
12+
#endif
813

914
torch::Tensor randomQuatTensor(long long n){
1015
torch::Tensor u = torch::rand(n);
@@ -386,6 +391,11 @@ void Model::afterTrain(int step){
386391
xysGradNorm = torch::Tensor();
387392
visCounts = torch::Tensor();
388393
max2DSize = torch::Tensor();
394+
#ifdef USE_HIP
395+
c10::hip::HIPCachingAllocator::emptyCache();
396+
#else
397+
c10::cuda::CUDACachingAllocator::emptyCache();
398+
#endif
389399
}
390400
}
391401

0 commit comments

Comments
 (0)