pub struct DynamicTensor {
pub tensor: Tensor,
pub node_id: Option<usize>,
pub graph: Option<Arc<DynamicGraph>>,
}Expand description
Wrapper for tensors in dynamic graph
Fields§
§tensor: TensorThe actual tensor
node_id: Option<usize>Node ID in the graph
graph: Option<Arc<DynamicGraph>>Reference to the graph
Implementations§
Source§impl DynamicTensor
impl DynamicTensor
Sourcepub fn new(tensor: Tensor, graph: Arc<DynamicGraph>) -> Self
pub fn new(tensor: Tensor, graph: Arc<DynamicGraph>) -> Self
Create a new dynamic tensor
Sourcepub fn from_tensor(tensor: Tensor) -> Self
pub fn from_tensor(tensor: Tensor) -> Self
Create from tensor without graph
Sourcepub fn add(&self, other: &DynamicTensor) -> DynamicTensor
pub fn add(&self, other: &DynamicTensor) -> DynamicTensor
Add two dynamic tensors
Sourcepub fn mul(&self, other: &DynamicTensor) -> DynamicTensor
pub fn mul(&self, other: &DynamicTensor) -> DynamicTensor
Multiply two dynamic tensors
Sourcepub fn matmul(&self, other: &DynamicTensor) -> DynamicTensor
pub fn matmul(&self, other: &DynamicTensor) -> DynamicTensor
Matrix multiplication
Sourcepub fn relu(&self) -> DynamicTensor
pub fn relu(&self) -> DynamicTensor
ReLU activation
Trait Implementations§
Source§impl Clone for DynamicTensor
impl Clone for DynamicTensor
Source§fn clone(&self) -> DynamicTensor
fn clone(&self) -> DynamicTensor
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DynamicTensor
impl !RefUnwindSafe for DynamicTensor
impl Send for DynamicTensor
impl Sync for DynamicTensor
impl Unpin for DynamicTensor
impl !UnwindSafe for DynamicTensor
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more