Hengyuan Cloud (Gpushare)_Technical chats of community partners

Article Source| Hengyuan Cloud Community

Original Address| Chat

Original author| Azhou


Make complaints

Regarding the axis of the numpy array, I can't always remember it, or it's rather vague. Every time I have to make a small array and test it myself to make sure I don't make a mistake. Today I made up my mind to remember this thing, and I made a formula for associative memory. If you don’t have this problem, don’t look down. It’s a shame.

above picture

In fact, to put it bluntly, it is to remember such a thing. If you have already remembered it clearly, don’t look down.

example

a = np.array([[1,1],[2,2]])
# [1 1]
# [2 2]
print(np.mean(a,axis=0))
#沿着axis0做平均
[1.5, 1.5] 

print(np.mean(a,axis=0))
#沿着axis1做平均
[1, 2]

associative memory

It's a shame.
axis=0, from top to bottom, From T op to B ottom ( TB )
axis=1, from left to right, From Left to Right ( LR )

That is
0TB
1LR

Associative memory is
not to (0) escape (TB)
to (1) comity (LR)

Or
Clear(0) Taobao(TB)
Buy(1) Braised Meat(LR)

Guess you like

Origin blog.csdn.net/weixin_39881439/article/details/124474268