I am building a framework to analyze generic flows in networks and I have the following (simplified) example:
use std::ops::Index;
use tch::Tensor;
pub trait Flows<F, Idx>: Index<Idx, Output = F> + Iterator<Item = F> {}
impl Flows<Tensor, Tensor> for Tensor {
// TODO
}
fn main() {
let t: Box<dyn Flows<Tensor, Tensor>> =
Box::new(Tensor::of_slice(&[3, 1, 4, 1, 5]));
}
Sometimes, flows will be represented using tch::Tensor
s, which appear to implement some of the following traits already: iter.rs - source. However, I can't seem to write the adapters correctly to dispatch standard rust calls to the underlying Tensor ones. Does anyone have any guidance? Thank you so much!