문서의 이전 판입니다!
outerproduct
a1 = np.array([[1, 2, 3], [1, 2, 3]])
a2 = np.array([[1, 2], [1, 2]])
a3 = np.array([[1, 2, 3, 4], [1, 2, 3, 4]])
np.einsum('bi,bj,bk->bijk', a1, a2, a3).reshape(2, -1).shape
rs = np.einsum('bi,bj,bk->bijk', a1, a2, a3).reshape(2, -1)
actions = rs.reshape(2, -1).argmax(axis=1)
a1_ = rs // 4 // 2 % 3
a2_ = rs // 4 % 2
a3_ = rs % 4
actions = list()
for n in [4, 2, 3]:
actions.append(rs % n)
rs = rs // n
actions = reversed(actions)