Home Torch negative dimension
Post
Cancel

Torch negative dimension

1
torch.cat(x, -1)

What does the negative dimension mean here? The “-1” essentially means the index among the tensor sizes, just like simple python.

For example, say we have a tensor with a size of (w * c * h * l).

torch.cat(x, -1) will concat the tensor along l (= torch.size()[-1]).

torch.cat(x, -1) can be rewritten as torch.cat(x, 3).

This post is licensed under CC BY 4.0 by the author.

Torch nn.modulelist

[Paper Review] Bao: Learning to Steer Query Optimizers