pub struct ScaleTransform<B: Backend + BackendOps<f32>, const D: usize> { /* private fields */ }Expand description
Scale about a fixed center: T(x) = scale * (x - center) + center.
Implementations§
Source§impl<B: Backend + BackendOps<f32>, const D: usize> ScaleTransform<B, D>
impl<B: Backend + BackendOps<f32>, const D: usize> ScaleTransform<B, D>
Sourcepub fn new(scale: Tensor<f32, B>, center: Tensor<f32, B>) -> Self
pub fn new(scale: Tensor<f32, B>, center: Tensor<f32, B>) -> Self
Construct a trainable scale parameter and fixed center.
§Panics
Panics unless both tensors have shape [D].
Sourcepub fn identity(center: Option<Tensor<f32, B>>, backend: &B) -> Self
pub fn identity(center: Option<Tensor<f32, B>>, backend: &B) -> Self
Construct the identity scale.
Trait Implementations§
Source§impl<B: Clone + Backend + BackendOps<f32>, const D: usize> Clone for ScaleTransform<B, D>
impl<B: Clone + Backend + BackendOps<f32>, const D: usize> Clone for ScaleTransform<B, D>
Source§impl<B: Backend + BackendOps<f32> + Default, const D: usize> Module<f32, B> for ScaleTransform<B, D>
impl<B: Backend + BackendOps<f32> + Default, const D: usize> Module<f32, B> for ScaleTransform<B, D>
Source§fn parameters(&self) -> Vec<Var<f32, B>>
fn parameters(&self) -> Vec<Var<f32, B>>
Collect all trainable parameters (including from sub-modules).
Source§fn named_parameters(&self) -> Vec<Parameter<f32, B>>
fn named_parameters(&self) -> Vec<Parameter<f32, B>>
Collect trainable parameters with stable hierarchical names. Read more
Source§fn forward(
&self,
input: &Var<f32, B>,
) -> Result<Var<f32, B>, ModuleError<<B as ComputeBackend>::Error>>
fn forward( &self, input: &Var<f32, B>, ) -> Result<Var<f32, B>, ModuleError<<B as ComputeBackend>::Error>>
Evaluate this module. Read more
Source§fn load_parameters(&mut self, parameters: &[Var<f32, B>])
fn load_parameters(&mut self, parameters: &[Var<f32, B>])
Write optimizer-updated parameter values back into this module’s own
fields, consuming
params in the same order parameters() enumerates
them (i.e. params.len() == parameters().len()). Read moreSource§fn load_named_parameters(
&mut self,
parameters: &[Parameter<T, B>],
) -> Result<(), ParameterLoadError>
fn load_named_parameters( &mut self, parameters: &[Parameter<T, B>], ) -> Result<(), ParameterLoadError>
Load optimizer-updated named parameters after validating the complete
stable path inventory. Read more
Source§impl<B: Backend + BackendOps<f32> + Default, const D: usize> Transform<B, D> for ScaleTransform<B, D>
impl<B: Backend + BackendOps<f32> + Default, const D: usize> Transform<B, D> for ScaleTransform<B, D>
Auto Trait Implementations§
impl<B, const D: usize> !RefUnwindSafe for ScaleTransform<B, D>
impl<B, const D: usize> !UnwindSafe for ScaleTransform<B, D>
impl<B, const D: usize> Freeze for ScaleTransform<B, D>
impl<B, const D: usize> Send for ScaleTransform<B, D>
impl<B, const D: usize> Sync for ScaleTransform<B, D>
impl<B, const D: usize> Unpin for ScaleTransform<B, D>
impl<B, const D: usize> UnsafeUnpin for ScaleTransform<B, D>
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.