pub trait DType: Debug {
// Required methods
fn as_any(&self) -> &dyn Any;
fn clone_boxed(&self) -> Box<dyn DType>;
fn equal(&self, rhs: &dyn DType) -> bool;
fn primitive_full_zero(&self) -> Box<dyn Primitive>;
fn primitive_full_one(&self) -> Box<dyn Primitive>;
fn primitive_rand(&self) -> Box<dyn Primitive>;
fn primitive_randn(&self) -> Box<dyn Primitive>;
fn primitive_as_dtype(&self) -> Box<dyn Primitive>;
fn size_of_elem(&self) -> usize;
fn safetensor_dtype(&self) -> Dtype;
}
Converts to this type from the input type.
Converts to this type from the input type.
This method tests for self
and other
values to be equal, and is used
by ==
.
This method tests for !=
. The default implementation is almost always
sufficient, and should not be overridden without very good reason.