Fix tf_wrapper
@@ -285,17 +285,17 @@ static void tf_adj(const nlop_data_t* _data, unsigned int o, unsigned int i, com
inp_tensors[j] = data->input_tensors[j];
}
- inp_ops[data->nr_inputs] = data->grad_ys_op[i];
- inp_tensors[data->nr_inputs] = tensor_allocate(data->nr_grad_ys_dim[i], data->grad_ys_dims_tf[i]);
+ inp_ops[data->nr_inputs] = data->grad_ys_op[o];
+ inp_tensors[data->nr_inputs] = tensor_allocate(data->nr_grad_ys_dim[o], data->grad_ys_dims_tf[o]);
- md_copy(data->nr_grad_ys_dim[i], data->grad_ys_dims_tf[i], TF_TensorData(inp_tensors[1]), src, CFL_SIZE);
+ md_copy(data->nr_grad_ys_dim[o], data->grad_ys_dims_tf[o], TF_TensorData(inp_tensors[data->nr_inputs]), src, CFL_SIZE);
struct TF_Tensor* out_tensor[1];
TF_SessionRun(data->sess,
/* RunOptions */ NULL,
/* Input tensors */ inp_ops, inp_tensors, data->nr_inputs + 1,
- /* Output tensors */ &(data->grad_op[o]), out_tensor, 1,
+ /* Output tensors */ &(data->grad_op[i]), out_tensor, 1,
/* Target operations */ NULL, 0,
/* RunMetadata */ NULL,
/* Output status */ data->status);
@@ -305,7 +305,7 @@ static void tf_adj(const nlop_data_t* _data, unsigned int o, unsigned int i, com
TF_DeleteTensor(inp_tensors[data->nr_inputs]);
- md_copy(data->nr_grad_dim[o], data->grad_dims_tf[o], dst, TF_TensorData(out_tensor[0]), CFL_SIZE);
+ md_copy(data->nr_grad_dim[i], data->grad_dims_tf[i], dst, TF_TensorData(out_tensor[0]), CFL_SIZE);
TF_DeleteTensor(out_tensor[0]);
#else
