make list OP tensor not multiply dimensions when list lenght is equal to tensor
This commit is contained in:
@@ -29,7 +29,7 @@ You can also get the node from comfy manager under the name of More math.
|
||||
- Boolean: `<`, `<=`, `>`, `>=`, `==`, `!=`
|
||||
(`false = 0.0`, `true = 1.0`)
|
||||
- Lists: `[v1, v2, ...]` (Vector math supported, mostly usefull in `conv` and `permute`)
|
||||
- You can also use lists to do math with input tensor (image, noise, conditioing, latent, audio) which results in batched output.
|
||||
- You can also use lists to do math with input tensor (image, noise, conditioing, latent, audio) which results in batched output as long as batch size is different to list size.
|
||||
- print_shape(a) = torch.Shape[1,1024,1024,3]; b = a*[0,0.2,-0.3]; print_shape(b) = torch.Shape[3,1024,1024,3]
|
||||
- You can <operator> batched tensor with another tensor which is not batched (dim[0] = 1) - the non batched tensor will be duplicated along batch dimension
|
||||
- In imageMath node you can use 3 element list to specify a color of image. You cannot use any imput tensor, doing so will result in behaviour in subpoint 1 in list
|
||||
|
||||
@@ -34,7 +34,10 @@ class UnifiedMathVisitor(MathExprVisitor):
|
||||
"""
|
||||
# one of them is a list and one is tensor
|
||||
if self._is_tensor(a) and self._is_list(b):
|
||||
return torch.cat([self._bin_op(a, x, torch_op, scalar_op) for x in b], dim=0)
|
||||
if(a.shape[0]==len(b)):
|
||||
c = torch.split(a,1)
|
||||
return torch.cat([self._bin_op(x, y, torch_op, scalar_op) for x,y in zip(a,c)],dim=0)
|
||||
return torch.cat([self._bin_op(a, x, torch_op, scalar_op) for x in b], dim=0)
|
||||
if self._is_list(a) and self._is_tensor(b):
|
||||
if(b.shape[0]==len(a)):
|
||||
c = torch.split(a,1)
|
||||
|
||||
Reference in New Issue
Block a user