-
-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Closed
Labels
Description
Describe the issue:
np.version = 2.3.2
GE.shape = (2, 3, 2) <- 3rd (numeric) rank tensor
E = [False, True]
depending on indexing syntax produces inconsistent result
GE[0,:,E] = [[0 0 1]]
GE[0][:,E] = [[0]
[0]
[1]]
has shape error: GE[0,:,E].shape = (1, 3)
vs correct shape via GE[0][:,E].shape = (3, 1)
Reproduce the code example:
import numpy as np
print("np.__version__ = ", np.__version__)
GE = np.moveaxis( np.asarray([((0,0,0), (0,0,2)), ((0,0,1), (0,1,0)), ]), 0, 2 )
E = [False, True]
print("GE.shape = ", GE.shape)
print("E = ", E)
print()
print("GE[0,:,E] = ", GE[0,:,E])
print("GE[0][:,E] = ", GE[0][:,E])
print(f"has shape error: GE[0,:,E].shape = {GE[0,:,E].shape} vs correct shape via GE[0][:,E].shape = {GE[0][:,E].shape}")
Error message:
there is no error message, just the result is wrong(?)
Python and NumPy Versions:
2.3.2
3.12.3 (main, Jun 18 2025, 17:59:45) [GCC 13.3.0]
Runtime Environment:
ubuntu 24.04.2 LTS (<- cat /etc/os-release )
Python 3.12.3 (<- python --version )
Context for the issue:
obtain unexpected wrong shape of matrix in calculation