Trait tensorflow::TensorType
source · pub trait TensorType: Default + Clone + Display + Debug + 'static {
// Required methods
fn data_type() -> DataType;
fn zero() -> Self;
fn one() -> Self;
fn is_repr_c() -> bool;
fn unpack(data: &[u8], count: usize) -> Result<Vec<Self>>;
fn pack(data: &[Self], dims: &[u64]) -> Result<*mut TF_Tensor>;
}
Expand description
A Rust type that maps to a DataType
.
Currently, all implementors must not implement Drop (or transitively contain anything that does) and must be bit-for-bit compatible with the corresponding C type. Clients must not implement this trait.
This trait doesn’t require num::Zero
or num::One
because some tensor
types (such as bool
and String
) don’t implement them and we need to
supply custom implementations.
Required Methods§
sourcefn is_repr_c() -> bool
fn is_repr_c() -> bool
Return true if the data has the same representation in C and Rust and can be written/read directly.