python - understanding the size and structure of multi-dimensional array -


when reading open source program, function outputs following multi-dimensional array. output referred batch. print(batch) generates following output. in order know structure of output. tried print(batch.shape), generates following error message print(batch.shape) attributeerror: 'tuple' object has no attribute 'shape' . possible ways understand structure/size of type of array structure?

enter image description here

a tuple, python list, has len property

len(batch)   # gives 2 

you can @ properties of elements of tuple iteration

for arr in batch:    print(arr.shape)    print(arr.dtype) 

or

 [arr.shape arr in batch] 

or

 batch[0].shape  batch[1].shape 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

python 3.5 - Pyqtgraph string in x tick -