diff --git a/ravpy/distributed/compute.py b/ravpy/distributed/compute.py index 6bb2444..ab01a36 100644 --- a/ravpy/distributed/compute.py +++ b/ravpy/distributed/compute.py @@ -38,7 +38,8 @@ def compute_locally_bm(*args, **kwargs): def compute_locally(payload, subgraph_id, graph_id): try: # print("Computing ",payload["operator"]) - # print('\n\nPAYLOAD: ',payload) + # print('\n\nPAYLOAD: ',payload['operator']) + values = [] @@ -273,6 +274,8 @@ def get_unary_result(value1, params, operator): result = forward_pass_flatten(value1, params=params) elif operator == "backward_pass_flatten": result = backward_pass_flatten(value1, params=params) + elif operator == "get_layer_result": + result = get_layer_result(value1, params=params) return result diff --git a/ravpy/distributed/op_functions/dl_ops.py b/ravpy/distributed/op_functions/dl_ops.py index 92c3dc2..784c494 100644 --- a/ravpy/distributed/op_functions/dl_ops.py +++ b/ravpy/distributed/op_functions/dl_ops.py @@ -593,4 +593,8 @@ def backward_pass_flatten(accum_grad, params=None):#prev_input=None, input_layer backward_pass_output = { 'accum_grad': accum_grad.reshape(prev_shape).tolist() } - return backward_pass_output \ No newline at end of file + return backward_pass_output + +def get_layer_result(X,params=None): + result=np.array(X['result']) + return result.tolist() \ No newline at end of file diff --git a/ravpy/strings.py b/ravpy/strings.py index 1e2b138..560f3ff 100644 --- a/ravpy/strings.py +++ b/ravpy/strings.py @@ -103,6 +103,7 @@ class Operators(object): ONE_HOT_ENCODING = "one_hot_encoding" SET_VALUE = "set_value" SQUEEZE = "squeeze" + GET_LAYER_RESULTS="get_layer_result" # Machine Learning Ops LINEAR_REGRESSION = "linear_regression" @@ -278,6 +279,7 @@ class TFJSOperators(object): 'federated_mean': Operators.FEDERATED_MEAN, 'federated_variance': Operators.FEDERATED_VARIANCE, 'federated_standard_deviation': Operators.FEDERATED_STANDARD_DEVIATION, + 'get_layer_result':Operators.GET_LAYER_RESULTS, }