Skip to content

Commit

Permalink
fix returning vector of pointers from TF_OperationAllInputs
Browse files Browse the repository at this point in the history
  • Loading branch information
pr0m1th3as committed Jun 30, 2024
1 parent 5f5d999 commit 806ac5a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/OCT_TF_Operation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,17 @@ octave_value OCT_TF_OperationAllInputs (OCT_ARGS)
(malloc (sizeof (TF_Output) * max_inputs));
// Get list of all inputs of Operation
TF_OperationAllInputs (oper, inputs, max_inputs);
// Return pointer to input array
octave_uint64 ptr = (uint64_t) inputs;
octave_value plhs = ptr;
// Copy pointers to retrieved Output inputs into returning octave value
dim_vector oct_dims;
oct_dims.resize (2);
oct_dims(0) = 1;
oct_dims(1) = max_inputs;
uint64NDArray oct_data(oct_dims);
for (int i = 0; i < max_inputs; i++)
{
oct_data(0,i) = (uint64_t) (inputs + i);
}
octave_value plhs = oct_data;
return plhs;
}

Expand Down

0 comments on commit 806ac5a

Please sign in to comment.