Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import numpy as np
#three dimensional arrays
a1=np.ones([2,3,1])
print (a1)
'''
#Output:
[[[1.]
[1.]
[1.]]
[[1.]
[1.]
[1.]]]
'''
a2=np.arange(1,13).reshape(2,3,2)
print (a2)
'''
#Output:
[[[ 1 2]
[ 3 4]
[ 5 6]]
[[ 7 8]
[ 9 10]
[11 12]]]
'''
print (a1+a2)
'''
#Output:
[[[ 2. 3.]
[ 4. 5.]
[ 6. 7.]]
[[ 8. 9.]
[10. 11.]
[12. 13.]]]
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment