You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fntf_ops_range(){// Create a range op that produces [0, 1, 2, 3, 4, 5]letmut scope = tensorflow::Scope::new_root_scope();let start = tensorflow::ops::constant(0_i32,&mut scope);let limit = tensorflow::ops::constant(6_i32,&mut scope);let delta = tensorflow::ops::constant(1_i32,&mut scope);let range_op = tensorflow::ops::range(start, limit, delta,&mut scope).unwrap();}// test tf_ops_range#[test]fntest_tf_ops_range(){tf_ops_range();}
report error:
let range_op = tensorflow::ops::range(start, limit, delta,&mut scope).unwrap();
| ---------------------- ^^^^^ the trait `From<Result<Operation,Status>>` is not implemented for `tensorflow::Output`
| |
| required by a bound introduced by this call
|
= help: the trait `From<Operation>` is implemented for `tensorflow::Output`
= note:requiredfor `Result<Operation,Status>` to implement `Into<tensorflow::Output>`
I looked through the relevant documents, including the source code, but unfortunately I didn't see an example of how to use range
Shorthand for Range::new().build(start, limit, delta, scope).
The text was updated successfully, but these errors were encountered:
When I changed to the following code, he output the results as I expected. range -> constant
use tensorflow::{Scopeas scope,Tensor};fntf_ops_range(){letmut scope = scope::new_root_scope();let x = tensorflow::ops::constant(&[0,1,2,3,4,5,6,7,8,9,10,11][..],&mut scope).unwrap();println!("x type: {:?}", x.get_attr_type("dtype").unwrap());let value:Tensor<i32> = x.get_attr_tensor("value").unwrap();println!("x value: {:?}", value);}// test tf_ops_range#[test]fntest_tf_ops_range(){tf_ops_range();}
I want to create a line vector x. The row vector contains the first 12 integers starting at 0, which are created by default as integers, for python example
this is my code
report error:
I looked through the relevant documents, including the source code, but unfortunately I didn't see an example of how to use
range
Shorthand for
Range::new().build(start, limit, delta, scope)
.The text was updated successfully, but these errors were encountered: