Skip to content
This repository was archived by the owner on Mar 17, 2026. It is now read-only.
This repository was archived by the owner on Mar 17, 2026. It is now read-only.

Is there an example of range related operation #420

@Jzow

Description

@Jzow

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions