【发布时间】:2019-09-22 21:26:47
【问题描述】:
在添加邻居语句(我用“新”评论)之前,一切正常。现在,当使用 numpy.asarray 时,出现以下错误:
ValueError: 无法将输入数组从形状 (3,3) 广播到形状 (3)。
我真的很困惑,因为新行并没有改变旋转数组的任何内容。
def rre(mesh, rotations):
"""
Relative Rotation Encoding (RRE).
Return a compact representation of all relative face rotations.
"""
all_rel_rotations = neighbors = []
for f in mesh.faces():
temp = [] # new
for n in mesh.ff(f):
rel_rotation = np.matmul(rotations[f.idx()], np.linalg.inv(rotations[n.idx()]))
all_rel_rotations.append(rel_rotation)
temp.append(n.idx()) # new
neighbors.append(temp) # new
all_rel_rotations = np.asarray(all_rel_rotations)
neighbors = np.asarray(neighbors) # new
return all_rel_rotations, neighbors
【问题讨论】:
-
能否请您编辑代码以提供输入和输出示例?
-
在
neighbors = np.asarray(neighbors)之前打印neighbors的值。 -
@unutbu:我不认为它是重复的
标签: python numpy valueerror openmesh