Skip to content

Commit

Permalink
gridencoder: fix pos_deriv in linear mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ashawkey committed Mar 3, 2023
1 parent ccc7030 commit c3fab17
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion gridencoder/src/gridencoder.cu
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ __global__ void kernel_grid(

// calculate coordinate (always use float for precision!)
float pos[D];
float pos_deriv[D] = {1.0f}; // linear deriv is default to 1
float pos_deriv[D];
uint32_t pos_grid[D];

#pragma unroll
Expand All @@ -152,7 +152,10 @@ __global__ void kernel_grid(
if (interp == 1) {
pos_deriv[d] = smoothstep_derivative(pos[d]);
pos[d] = smoothstep(pos[d]);
} else {
pos_deriv[d] = 1.0f; // linear deriv is default to 1
}

}

//printf("[b=%d, l=%d] pos=(%f, %f)+(%d, %d)\n", b, level, pos[0], pos[1], pos_grid[0], pos_grid[1]);
Expand Down

0 comments on commit c3fab17

Please sign in to comment.