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?
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
Post a Comment