Skip to content

Commit 6787328

Browse files
committed
Remove Redundent Comments
1 parent c8841dc commit 6787328

File tree

5 files changed

+17
-8
lines changed

5 files changed

+17
-8
lines changed

cuda_rasterizer/forward.cu

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,13 @@ renderCUDA(
266266
int W, int H,
267267
const float2* __restrict__ points_xy_image,
268268
const float* __restrict__ features,
269+
const float* __restrict__ depths,
269270
const float4* __restrict__ conic_opacity,
270271
float* __restrict__ final_T,
271272
uint32_t* __restrict__ n_contrib,
272273
const float* __restrict__ bg_color,
273-
float* __restrict__ out_color)
274+
float* __restrict__ out_color,
275+
float* __restrict__ out_depth)
274276
{
275277
// Identify current tile and associated min/max pixel range.
276278
auto block = cg::this_thread_block();
@@ -301,6 +303,7 @@ renderCUDA(
301303
uint32_t contributor = 0;
302304
uint32_t last_contributor = 0;
303305
float C[CHANNELS] = { 0 };
306+
float D = { 0 };
304307

305308
// Iterate over batches until all done or range is complete
306309
for (int i = 0; i < rounds; i++, toDo -= BLOCK_SIZE)
@@ -353,6 +356,7 @@ renderCUDA(
353356
// Eq. (3) from 3D Gaussian splatting paper.
354357
for (int ch = 0; ch < CHANNELS; ch++)
355358
C[ch] += features[collected_id[j] * CHANNELS + ch] * alpha * T;
359+
D += depths[collected_id[j]] * alpha * T;
356360

357361
T = test_T;
358362

@@ -370,6 +374,7 @@ renderCUDA(
370374
n_contrib[pix_id] = last_contributor;
371375
for (int ch = 0; ch < CHANNELS; ch++)
372376
out_color[ch * H * W + pix_id] = C[ch] + T * bg_color[ch];
377+
out_depth[pix_id] = D;
373378
}
374379
}
375380

@@ -380,23 +385,27 @@ void FORWARD::render(
380385
int W, int H,
381386
const float2* means2D,
382387
const float* colors,
388+
const float* depths,
383389
const float4* conic_opacity,
384390
float* final_T,
385391
uint32_t* n_contrib,
386392
const float* bg_color,
387-
float* out_color)
393+
float* out_color,
394+
float* out_depth)
388395
{
389396
renderCUDA<NUM_CHANNELS> << <grid, block >> > (
390397
ranges,
391398
point_list,
392399
W, H,
393400
means2D,
394401
colors,
402+
depths,
395403
conic_opacity,
396404
final_T,
397405
n_contrib,
398406
bg_color,
399-
out_color);
407+
out_color,
408+
out_depth);
400409
}
401410

402411
void FORWARD::preprocess(int P, int D, int M,

cuda_rasterizer/rasterizer_impl.cu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ CudaRasterizer::BinningState CudaRasterizer::BinningState::fromChunk(char*& chun
195195

196196
// Forward rendering procedure for differentiable rasterization
197197
// of Gaussians.
198-
int CudaRasterizer::Rasterizer::forward( // TODO
198+
int CudaRasterizer::Rasterizer::forward(
199199
std::function<char* (size_t)> geometryBuffer,
200200
std::function<char* (size_t)> binningBuffer,
201201
std::function<char* (size_t)> imageBuffer,
@@ -433,4 +433,4 @@ void CudaRasterizer::Rasterizer::backward(
433433
dL_dsh,
434434
(glm::vec3*)dL_dscale,
435435
(glm::vec4*)dL_drot);
436-
}
436+
}

diff_gaussian_rasterization/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def forward(
8484
return color, radii, depth
8585

8686
@staticmethod
87-
def backward(ctx, grad_out_color, _):
87+
def backward(ctx, grad_out_color, grad_radii, grad_depth):
8888

8989
# Restore necessary values from context
9090
num_rendered = ctx.num_rendered

rasterize_points.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ std::function<char*(size_t N)> resizeFunctional(torch::Tensor& t) {
3232
return lambda;
3333
}
3434

35-
std::tuple<int, torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor>
35+
std::tuple<int, torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor>
3636
RasterizeGaussiansCUDA(
3737
const torch::Tensor& background,
3838
const torch::Tensor& means3D,

rasterize_points.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <tuple>
1616
#include <string>
1717

18-
std::tuple<int, torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor>
18+
std::tuple<int, torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor>
1919
RasterizeGaussiansCUDA(
2020
const torch::Tensor& background,
2121
const torch::Tensor& means3D,

0 commit comments

Comments
 (0)