Open Corallus-Caninus opened 2 years ago
I was able to work around this by manually creating outputs after using some reflection on the tensorflow objects to find the outputs then indexing the Outputs from the object (method table?)
//verify the output exists by tensorflow reflection:
let output_list_lengths = input_tensor_op.clone().output_list_length("flow");
println!("flow output has length: {:?}", output_list_lengths);
let output_list_lengths = input_tensor_op.clone().output_list_length("handle");
println!("handle output has length: {:?}", output_list_lengths);
//I guessed until these were the correct type given index, the documentation seems to list them in index order:
//create an output manually by getting its index
let handle_output = tf_output {
operation: input_tensor_op.clone(),
index: 0,
};
let flow_output = tf_output {
operation: input_tensor_op.clone(),
index: 1,
};
however this does not close this issue.
Duplicate #357
edited: This is not dup of the above issue.
is there any plan for making Operation Output returns a little more ergonomic? I currently have to count the position of an Operation's Outputs then index it according to C++ documentation. I think I can write some bindgen for each output with .getoutput* methods but I am still learning the codebase.
Can we close this with Operation instances?
I will be referencing the following documentation: https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/tensor-array https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/tensor-array-write
as well as the following source code: src/graph.rs @ line 1195 function get_attr_metadata and the following getattr* src/ops/ops_impl @ line 123054 struct TensorArrayWriteV3 and the implementations
TensorArray is expected to return handle and flow according to the C++ API
These Output types are required for tensor_array_write (tensor_array_write_v3 in my case).
However, going through the source in graph.rs I can only read attributes as native type to recover these outputs, e.g.: &str and f32. TensorArrayV3,s constructor only returns one Output type.
tensor_array_write_v3() has all its generics set as into
I have tried passing this Output type into tensor_array_write_v3 by cloning my TensorArray object for handle and flow parameters, hoping Tensorflow will associate the handle and flow attributes as Output types but this throws an internal error that is
for posterity, this is my function being developed and tested: