pub struct SparseTensorBuilder { /* private fields */ }Expand description
Builder for sparse tensors.
Implementations§
Source§impl SparseTensorBuilder
impl SparseTensorBuilder
Sourcepub fn new(shape: Vec<usize>, format: SparseFormat) -> Self
pub fn new(shape: Vec<usize>, format: SparseFormat) -> Self
Create a new sparse tensor builder.
Sourcepub fn add_entry(
&mut self,
indices: Vec<usize>,
value: f64,
) -> Result<(), SparseError>
pub fn add_entry( &mut self, indices: Vec<usize>, value: f64, ) -> Result<(), SparseError>
Add a non-zero entry.
Sourcepub fn build(self) -> Result<SparseTensor, SparseError>
pub fn build(self) -> Result<SparseTensor, SparseError>
Build the sparse tensor.
Auto Trait Implementations§
impl Freeze for SparseTensorBuilder
impl RefUnwindSafe for SparseTensorBuilder
impl Send for SparseTensorBuilder
impl Sync for SparseTensorBuilder
impl Unpin for SparseTensorBuilder
impl UnwindSafe for SparseTensorBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more