Created by: Durman
Addressed problem description
This adds experimental decorator which solves vectorization problem.
This is how it works.
from sverchok.utils import vectorize
def main_node_logic(*, prop_a: List[float], prop_b: Matrix, mode_a: str) -> Tuple[list, list]:
...
return data1, data2
class MyNode:
...
def process(self):
input_a = self.inputs[0].sv_get(default=None)
input_b = self.inputs[1].sv_get(default=None)
main_node_logic = vectorize(main_node_logic, match_mode=self.match_mode)
out1, out2 = main_node_logic(input_a, input_b, mode_a = self.mode_a)
self.outputs[0].sv_set(out1)
self.outputs[1].sv_set(out2)
In this example input_a
can be one float value, list of floats or list of list of floats of arbitrary shape ([1, [[2, 3], 4], 5, 6]
).
This is true and for all other parameters of the function.
If the shape of an input data is different from each other it will be matched according match_mode
parameter which can repeat last, cycle etc.
Closes #3988 (closed)
Preflight checklist
-
Code changes complete. -
Code documentation complete. -
Manual testing done. -
Unit-tests implemented. -
Ready for merge.