Skip to content

Commit b3150cf

Browse files
authored
Fix uninitialized variables
1 parent 85329af commit b3150cf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

soft_renderer/cuda/soft_rasterize_cuda_kernel.cu

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ __device__ __forceinline__ void backward_barycentric_p2f_distance(scalar_t grad_
177177

178178
template <typename scalar_t>
179179
__device__ __forceinline__ scalar_t forward_sample_texture(const scalar_t *texture, const scalar_t *w, const int R, const int k, const int texture_sample_type) {
180-
scalar_t texture_k;
180+
scalar_t texture_k = 0;
181181
if (texture_sample_type == 0) { // sample surface color with resolution as R
182182
const int w_x = w[0] * R;
183183
const int w_y = w[1] * R;
@@ -196,7 +196,7 @@ __device__ __forceinline__ scalar_t forward_sample_texture(const scalar_t *textu
196196

197197
template <typename scalar_t>
198198
__device__ __forceinline__ scalar_t backward_sample_texture(const scalar_t grad_color, const scalar_t *w, const int R, const int k, const int texture_sample_type) {
199-
scalar_t grad_texture_k;
199+
scalar_t grad_texture_k = 0;
200200
if (texture_sample_type == 0) { // sample surface color with resolution as R
201201
const int w_x = w[0] * R;
202202
const int w_y = w[1] * R;
@@ -778,4 +778,4 @@ std::vector<at::Tensor> backward_soft_rasterize_cuda(
778778
printf("Error in backward_soft_rasterize: %s\n", cudaGetErrorString(err));
779779

780780
return {grad_faces, grad_textures};
781-
}
781+
}

0 commit comments

Comments
 (0)