Using rust crate tensorflow version = "0.21", with features = ["eager","tensorflow_gpu"], the following code compiles cleanly but gives this weird runtime error: NotFound: No attr named 'U' in NodeDef.
// Create an eager execution context with the specified options
let options = ContextOptions::new();
let ctx = Context::new(options).unwrap();
let oth = original_tensor.to_handle(&ctx).unwrap();
let otr = orig_tensor_rejoined.to_handle(&ctx).unwrap();
unsafe {
let raw_sum: Tensor<f32> = add(&ctx, &oth, &otr)
.unwrap()
.resolve()
.unwrap() // turning the resulting ReadonlyTensor, here, back into a tensor is unsafe
.into_tensor();
let r_handle = raw_sum.into_handle(&ctx).unwrap();
// Use the print op to print the tensor. This part is inside the unsafe block only due to scope of
// raw_sum
println!("Raw sum is:");
print(&ctx, &r_handle, &oth).unwrap();
}
The documentation for the C++ api seems to suggest that while &r_handle is a reference to a TensorHandle (as I have), the &oth should be a reference (pointer) to a list of tensors to print out when op is evaluated (see docs here: tensorflow::ops::Print Class Reference | TensorFlow v2.16.1) but this is not at all clear to me (what is the difference and why).
In my code, if I try to replace &oth with some kind of reference to an array of handles, the code won't compile. Is this a bug in the tensorflow crate or am I doing something wrong?