#420·rust

Is there an example of range related operation

Author: JzowCreated Dec 26, 2023Updated Dec 26, 2023

this is my code

fn tf_ops_range() {
    // Create a range op that produces [0, 1, 2, 3, 4, 5]
    let mut 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]
fn test_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: required for `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).