-
Notifications
You must be signed in to change notification settings - Fork 87
/
rasterize_gaussians.hpp
57 lines (48 loc) · 1.78 KB
/
rasterize_gaussians.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef RASTERIZE_GAUSSIANS_H
#define RASTERIZE_GAUSSIANS_H
#include <torch/torch.h>
#include "tile_bounds.hpp"
using namespace torch::autograd;
#if defined(USE_HIP) || defined(USE_CUDA) || defined(USE_MPS)
std::tuple<torch::Tensor,
torch::Tensor,
torch::Tensor,
torch::Tensor,
torch::Tensor> binAndSortGaussians(int numPoints, int numIntersects,
torch::Tensor xys,
torch::Tensor depths,
torch::Tensor radii,
torch::Tensor cumTilesHit,
TileBounds tileBounds);
class RasterizeGaussians : public Function<RasterizeGaussians>{
public:
static torch::Tensor forward(AutogradContext *ctx,
torch::Tensor xys,
torch::Tensor depths,
torch::Tensor radii,
torch::Tensor conics,
torch::Tensor numTilesHit,
torch::Tensor colors,
torch::Tensor opacity,
int imgHeight,
int imgWidth,
torch::Tensor background);
static tensor_list backward(AutogradContext *ctx, tensor_list grad_outputs);
};
#endif
class RasterizeGaussiansCPU : public Function<RasterizeGaussiansCPU>{
public:
static torch::Tensor forward(AutogradContext *ctx,
torch::Tensor xys,
torch::Tensor radii,
torch::Tensor conics,
torch::Tensor colors,
torch::Tensor opacity,
torch::Tensor cov2d,
torch::Tensor camDepths,
int imgHeight,
int imgWidth,
torch::Tensor background);
static tensor_list backward(AutogradContext *ctx, tensor_list grad_outputs);
};
#endif