Skip to content

Commit

Permalink
OP pt: add contiguous in grad output (deepmodeling#3917)
Browse files Browse the repository at this point in the history
deepmodeling#3910

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved tensor handling in the `Border` class to ensure proper memory
management and performance by making tensors contiguous.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
CaRoLZhangxy authored Jun 27, 2024
1 parent 58b8944 commit 949c3b8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion source/op/pt/comm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class Border : public torch::autograd::Function<Border> {
torch::Tensor nlocal_tensor = saved_variables[6];
torch::Tensor nghost_tensor = saved_variables[7];

torch::Tensor d_local_g1_tensor = grad_output[0];
torch::Tensor d_local_g1_tensor = grad_output[0].contiguous();
#ifdef USE_MPI
int mpi_init = 0;
MPI_Initialized(&mpi_init);
Expand Down

0 comments on commit 949c3b8

Please sign in to comment.