Home > other >  About numpy using high dimensional array as array indices
About numpy using high dimensional array as array indices

Time:09-21

>> The import torch
> A=torch. Tensor ([[1, 2], [3, 4]])
> B=torch. Tensor ([[0], [1]])
> [b]
Tensor ([[[1, 2]],

[[3, 4]]])
> B=torch. Tensor ([0, 1])
> [b]
Tensor ([[1, 2],
[3, 4]])
> A
Tensor ([[1, 2],
[3, 4]])
> B=torch. Tensor ([[0, 1], [1, 0]])
> [b]
Tensor ([[[1, 2],
[3, 4]],

[[3, 4],
[1, 2]]])

There are a great god can tell me what is this principle? Why do I use the index dimension instead ascend?

CodePudding user response:

Haven't seen the torch to understand!
But I did not too see you use the index of normal?
> A=torch. Tensor ([[1, 2], [3, 4]])
> B=torch. Tensor ([[0], [1]])
> [b]

According to your 2 d array, normal use index should not be these way?
> A [0]
> A [0] [0]
Such as, or
> A [b [0] [0]]
> A [b [0] [1]]

As far as you are using a [b] dimension rose, much more then you can check the Tensor object index parameter information!
  • Related