np.flip
Params :
m : array_like
axis : None or int or tuple of int
returns : array_like
axis 기준으로 reversed 한 m 의 view
설명 :
axis를 정하면 축을 기준으로 원소들을 reversed 한다. 축을 정하지않으면 모든축에 대해서 reversed 한다.
A = np.arange(8).reshape((2,2,2))
print(A)
'''
array([[[0, 1],
[2, 3]],
[[4, 5],
[6, 7]]])
'''
print(np.flip(A))
'''
array([[[7, 6],
[5, 4]],
[[3, 2],
[1, 0]]])
'''
print(np.flip(A, 0))
'''
array([[[4, 5],
[6, 7]],
[[0, 1],
[2, 3]]])
'''
print(np.flip(A, (1,2)))
'''
array([[[3, 2],
[1, 0]],
[[7, 6],
[5, 4]]])
'''
'오늘 > 오늘의 함수' 카테고리의 다른 글
[tensorflow] tf.math.add_n, tf.math.reduce_mean, tf.cinsum (0) | 2021.12.09 |
---|---|
[numpy] np.ufunc.accumulate (0) | 2021.12.08 |
[Python] functools.partial (0) | 2021.12.04 |
[numpy] np.linspace, np.meshgrid np.logspace (0) | 2021.10.31 |
[sklearn] stats.expon, stats.reciprocal (0) | 2021.10.28 |