pub struct TensorOpsContext { /* private fields */ }Expand description
Tensor operations context
Implementations§
Source§impl TensorOpsContext
impl TensorOpsContext
Sourcepub fn new(config: TensorConfig) -> Self
pub fn new(config: TensorConfig) -> Self
Create new tensor operations context
Sourcepub fn from_array<D: Dimension>(
&mut self,
array: &Array<Float, D>,
) -> Result<Tensor>
pub fn from_array<D: Dimension>( &mut self, array: &Array<Float, D>, ) -> Result<Tensor>
Create tensor from ndarray
Sourcepub fn full(&mut self, shape: &[usize], value: Float) -> Result<Tensor>
pub fn full(&mut self, shape: &[usize], value: Float) -> Result<Tensor>
Create tensor with specific shape and fill value
Sourcepub fn activation(
&mut self,
tensor: &Tensor,
activation: ActivationType,
) -> Result<Tensor>
pub fn activation( &mut self, tensor: &Tensor, activation: ActivationType, ) -> Result<Tensor>
Apply activation function
Sourcepub fn reduce(
&mut self,
tensor: &Tensor,
reduction: ReductionType,
axis: Option<usize>,
) -> Result<Tensor>
pub fn reduce( &mut self, tensor: &Tensor, reduction: ReductionType, axis: Option<usize>, ) -> Result<Tensor>
Reduction operations
Sourcepub fn reshape(
&mut self,
tensor: &Tensor,
new_shape: &[usize],
) -> Result<Tensor>
pub fn reshape( &mut self, tensor: &Tensor, new_shape: &[usize], ) -> Result<Tensor>
Reshape tensor
Sourcepub fn transpose(&mut self, tensor: &Tensor, axes: &[usize]) -> Result<Tensor>
pub fn transpose(&mut self, tensor: &Tensor, axes: &[usize]) -> Result<Tensor>
Transpose tensor
Sourcepub fn concat(&mut self, tensors: &[&Tensor], axis: usize) -> Result<Tensor>
pub fn concat(&mut self, tensors: &[&Tensor], axis: usize) -> Result<Tensor>
Concatenate tensors along axis
Sourcepub fn ensemble_aggregate(
&mut self,
predictions: &[&Tensor],
weights: Option<&Tensor>,
aggregation: AggregationType,
) -> Result<Tensor>
pub fn ensemble_aggregate( &mut self, predictions: &[&Tensor], weights: Option<&Tensor>, aggregation: AggregationType, ) -> Result<Tensor>
Ensemble-specific operations
Sourcepub fn batch_ensemble_forward(
&mut self,
inputs: &[&Tensor],
models: &[&Tensor],
) -> Result<Vec<Tensor>>
pub fn batch_ensemble_forward( &mut self, inputs: &[&Tensor], models: &[&Tensor], ) -> Result<Vec<Tensor>>
Batch operations for ensemble training
Sourcepub fn backward(&mut self, loss: &Tensor) -> Result<HashMap<String, Tensor>>
pub fn backward(&mut self, loss: &Tensor) -> Result<HashMap<String, Tensor>>
Backward pass for gradient computation
Sourcepub fn get_computation_graph(&self) -> &ComputationGraph
pub fn get_computation_graph(&self) -> &ComputationGraph
Get computation graph
Sourcepub fn clear_graph(&mut self)
pub fn clear_graph(&mut self)
Clear computation graph
Auto Trait Implementations§
impl Freeze for TensorOpsContext
impl RefUnwindSafe for TensorOpsContext
impl Send for TensorOpsContext
impl Sync for TensorOpsContext
impl Unpin for TensorOpsContext
impl UnwindSafe for TensorOpsContext
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> 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