Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import numpy as np
# Dimensions and shape of the arrays are different
a1=np.ones([3,2])
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