def __mul__(self, other):
if not isinstance(other, Node):
other = Node(data=other)
if other.type == 'val':
if other.value in (1, Color((1,1,1)), Vector((1,1,1))):
return self # useless addition if other is zero
if self.type == 'val':
if self.value in (1, Color((1,1,1)), Vector((1,1,1))):
return other # useless addition if other is zero
return Node('MULTIPLY', inputs=(self, other))
评论列表
文章目录