I need to get the first and last dimension of an numpy.ndarray of arbitrary size.
If I have shape(A) = (3,4,4,4,4,4,4,3)
my first Idea would be to do result = shape(A)[0,-1]
but that doesn't seem to work with tuples, why not ??
Is there a neater way of doing this than
s=shape(A)
result=(s[0], s[-1])
Thanks for any help
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With