Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x1 = np.arange(27.0).reshape((3, 3, 3))
- # x1 is (3,3,3)
- x2 = x1.min(axis=(1,2))
- # x2 is (3,)
- (x1 - x2).shape
- #Output: (3, 3, 3)
- (x1 - x2).shape == x1.shape
- #As expected: True
- mat1 = np.random.rand(10,5,2,1)
- # mat1 is (10,5,2,1)
- mat2 = mat1.min(axis = (1,2,3))
- # mat2 is (10,)
- (mat1 - mat2).shape == mat1.shape
- # Should be True, but
- #Output: False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement