Unverified Commit efbb2220 authored by Gao, Xiang's avatar Gao, Xiang Committed by GitHub
Browse files

Improve cumsum_from_zero a bit (#438)


Co-authored-by: default avatarFarhad Ramezanghorbani <farhadrgh@users.noreply.github.com>
parent 7a95e55e
......@@ -212,8 +212,8 @@ def triu_index(num_species: int) -> Tensor:
def cumsum_from_zero(input_: Tensor) -> Tensor:
cumsum = torch.cumsum(input_, dim=0)
cumsum = torch.cat([input_.new_zeros(1), cumsum[:-1]])
cumsum = torch.zeros_like(input_)
torch.cumsum(input_[:-1], dim=0, out=cumsum[1:])
return cumsum
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment