flojoy-ai/python

Update VectorXY class fields to store input data dictionaries

azmainadel opened this issue · 0 comments

We have updated the backend functions for some nodes (ADD, MULTIPLY) to return all the input values as a dictionary in x and output value in y.

@flojoy
def ADD(v, params):
    ''' Add 2 input vectors and return the result '''
    x0 = [0]
    x1 = [0]
    
    if len(v) == 2:
        x0 = v[0].y
        x1 = v[1].y
        
    y = np.add(x0, x1)

    return VectorXY(x = {x0, x1}, y = y)

Currently, the VectorXY class fields can only be valid np arrays.
We have to modify the constructor and getter-setter so that the field x can be a valid dictionary of np arrays.