SoftMax

Struct SoftMax 

Source
pub struct SoftMax<U, D>
where U: UnitValue<U>, D: Device<U>,
{ /* private fields */ }
Expand description

SoftMax Implementation

Implementations§

Source§

impl<U, D> SoftMax<U, D>
where U: UnitValue<U>, D: Device<U>,

Source

pub fn new(_: &D) -> SoftMax<U, D>

Create an instance of SoftMax

Trait Implementations§

Source§

impl<U, const N: usize> Activation<U, Arr<U, N>, Arr<U, N>, DeviceCpu<U>> for SoftMax<U, DeviceCpu<U>>
where U: UnitValue<U>,

Source§

fn apply( &self, device: &DeviceCpu<U>, input: &Arr<U, N>, ) -> Result<Arr<U, N>, EvaluateError>

Apply the activation function Read more
Source§

fn derive( &self, device: &DeviceCpu<U>, o: &Arr<U, N>, loss: &Arr<U, N>, u: &Arr<U, N>, ) -> Result<Arr<U, N>, TrainingError>

Apply derivatives of the activation function Read more
Returns whether or not the canonical linkage function can be used. Read more
Source§

impl<'a, U, const N: usize> Activation<U, ArrView<'a, U, N>, Arr<U, N>, DeviceCpu<U>> for SoftMax<U, DeviceCpu<U>>
where U: UnitValue<U>,

Source§

fn apply( &self, device: &DeviceCpu<U>, input: &ArrView<'a, U, N>, ) -> Result<Arr<U, N>, EvaluateError>

Apply the activation function Read more
Source§

fn derive( &self, device: &DeviceCpu<U>, o: &ArrView<'a, U, N>, loss: &ArrView<'a, U, N>, u: &ArrView<'a, U, N>, ) -> Result<Arr<U, N>, TrainingError>

Apply derivatives of the activation function Read more
Returns whether or not the canonical linkage function can be used. Read more
Source§

impl<'a, U, const N: usize> Activation<U, CudaTensor1dPtrView<'a, U, N>, CudaTensor1dPtr<U, N>, DeviceGpu<U>> for SoftMax<U, DeviceGpu<U>>
where U: UnitValue<U> + DataTypeInfo, DeviceGpu<U>: Device<U>, CudaPtr<U>: TryFrom<U, Error = CudaError>, for<'b> SoftMaxForward<'b, U, N>: Kernel<Args = ActivationForwardArgs<'b, U, N>>, for<'b> SoftMaxBackward<'b, U, N>: Kernel<Args = ActivationBackwardArgs<'b, U, N>>,

Source§

fn apply( &self, device: &DeviceGpu<U>, input: &CudaTensor1dPtrView<'a, U, N>, ) -> Result<CudaTensor1dPtr<U, N>, EvaluateError>

Apply the activation function Read more
Source§

fn derive( &self, device: &DeviceGpu<U>, o: &CudaTensor1dPtrView<'a, U, N>, loss: &CudaTensor1dPtrView<'a, U, N>, u: &CudaTensor1dPtrView<'a, U, N>, ) -> Result<CudaTensor1dPtr<U, N>, TrainingError>

Apply derivatives of the activation function Read more
Returns whether or not the canonical linkage function can be used. Read more
Source§

impl<U, I, const N: usize> Activation<U, I, Arr<U, N>, DeviceCpu<U>> for SoftMax<U, DeviceCpu<U>>
where U: UnitValue<U>, I: Iterator<Item = U> + Clone,

Source§

fn apply(&self, _: &DeviceCpu<U>, input: &I) -> Result<Arr<U, N>, EvaluateError>

Apply the activation function Read more
Source§

fn derive( &self, _: &DeviceCpu<U>, o: &I, loss: &I, _: &I, ) -> Result<Arr<U, N>, TrainingError>

Apply derivatives of the activation function Read more
Returns whether or not the canonical linkage function can be used. Read more
Source§

impl<'a, U, const N: usize> BatchActivation<U, CudaVecView<'a, U, CudaTensor1dPtr<U, N>>, CudaVec<U, CudaTensor1dPtr<U, N>>, DeviceGpu<U>> for SoftMax<U, DeviceGpu<U>>
where U: UnitValue<U> + DataTypeInfo, DeviceGpu<U>: Device<U>, for<'b> SoftMaxBatchForward<'b, U, N>: Kernel<Args = ActivationBatchForwardArgs<'b, U, N>>, for<'b> SoftMaxBatchBackward<'b, U, N>: Kernel<Args = ActivationBatchBackwardArgs<'b, U, N>>,

Source§

fn batch_apply( &self, device: &DeviceGpu<U>, input: &CudaVecView<'a, U, CudaTensor1dPtr<U, N>>, ) -> Result<CudaVec<U, CudaTensor1dPtr<U, N>>, TrainingError>

Apply the activation function Read more
Source§

fn batch_derive( &self, device: &DeviceGpu<U>, o: &CudaVecView<'a, U, CudaTensor1dPtr<U, N>>, loss: &CudaVecView<'a, U, CudaTensor1dPtr<U, N>>, u: &CudaVecView<'a, U, CudaTensor1dPtr<U, N>>, ) -> Result<CudaVec<U, CudaTensor1dPtr<U, N>>, TrainingError>

Apply derivatives of the activation function Read more
Source§

impl<U, const N: usize> BatchActivation<U, SerializedVec<U, Arr<U, N>>, SerializedVec<U, Arr<U, N>>, DeviceCpu<U>> for SoftMax<U, DeviceCpu<U>>
where U: UnitValue<U>, Vec<Arr<U, N>>: FromParallelIterator<Arr<U, N>>,

Source§

fn batch_apply( &self, device: &DeviceCpu<U>, input: &SerializedVec<U, Arr<U, N>>, ) -> Result<SerializedVec<U, Arr<U, N>>, TrainingError>

Apply the activation function Read more
Source§

fn batch_derive( &self, device: &DeviceCpu<U>, o: &SerializedVec<U, Arr<U, N>>, loss: &SerializedVec<U, Arr<U, N>>, u: &SerializedVec<U, Arr<U, N>>, ) -> Result<SerializedVec<U, Arr<U, N>>, TrainingError>

Apply derivatives of the activation function Read more
Source§

impl<'a, U, const N: usize> BatchActivation<U, SerializedVecView<'a, U, Arr<U, N>>, SerializedVec<U, Arr<U, N>>, DeviceCpu<U>> for SoftMax<U, DeviceCpu<U>>
where U: UnitValue<U>, Vec<Arr<U, N>>: FromParallelIterator<Arr<U, N>>,

Source§

fn batch_apply( &self, device: &DeviceCpu<U>, input: &SerializedVecView<'a, U, Arr<U, N>>, ) -> Result<SerializedVec<U, Arr<U, N>>, TrainingError>

Apply the activation function Read more
Source§

fn batch_derive( &self, device: &DeviceCpu<U>, o: &SerializedVecView<'a, U, Arr<U, N>>, loss: &SerializedVecView<'a, U, Arr<U, N>>, u: &SerializedVecView<'a, U, Arr<U, N>>, ) -> Result<SerializedVec<U, Arr<U, N>>, TrainingError>

Apply derivatives of the activation function Read more

Auto Trait Implementations§

§

impl<U, D> Freeze for SoftMax<U, D>

§

impl<U, D> RefUnwindSafe for SoftMax<U, D>

§

impl<U, D> Send for SoftMax<U, D>
where D: Send,

§

impl<U, D> Sync for SoftMax<U, D>
where D: Sync,

§

impl<U, D> Unpin for SoftMax<U, D>
where U: Unpin, D: Unpin,

§

impl<U, D> UnwindSafe for SoftMax<U, D>
where U: UnwindSafe, D: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.