Trait dfdx::tensor_ops::TryUpscale2D
source · pub trait TryUpscale2D {
// Provided methods
fn upscale2d<const OH: usize, const OW: usize, M: UpscaleMethod>(
self,
method: M
) -> <Self as GenericUpscale2D<M>>::Output<Const<OH>, Const<OW>>
where Self: GenericUpscale2D<M> { ... }
fn try_upscale2d<const OH: usize, const OW: usize, M: UpscaleMethod>(
self,
method: M
) -> Result<<Self as GenericUpscale2D<M>>::Output<Const<OH>, Const<OW>>, Self::Err>
where Self: GenericUpscale2D<M> { ... }
fn upscale2d_like<OH: Dim, OW: Dim, M: UpscaleMethod>(
self,
method: M,
height: OH,
width: OW
) -> <Self as GenericUpscale2D<M>>::Output<OH, OW>
where Self: GenericUpscale2D<M> { ... }
fn try_upscale2d_like<OH: Dim, OW: Dim, M: UpscaleMethod>(
self,
method: M,
height: OH,
width: OW
) -> Result<<Self as GenericUpscale2D<M>>::Output<OH, OW>, Self::Err>
where Self: GenericUpscale2D<M> { ... }
}
Expand description
Upscales an image to a new shape. Valid methods of upscaling are:
- NearestNeighbor pytorch equivalent:
F.interpolate(..., mode="nearest")
- Bilinear pytorch equivalent:
F.interpolate(..., mode="bilinear", align_corners=True)
Compile time upscale:
let t: Tensor<Rank3<3, 32, 32>, f32, _> = dev.zeros();
let y: Tensor<Rank3<3, 64, 64>, f32, _> = t.upscale2d(NearestNeighbor);
Runtime upscale:
let t: Tensor<Rank3<3, 32, 32>, f32, _> = dev.zeros();
let y: Tensor<(Const<3>, usize, usize), f32, _> = t.upscale2d_like(NearestNeighbor, 64, 64);
Provided Methods§
sourcefn upscale2d<const OH: usize, const OW: usize, M: UpscaleMethod>(
self,
method: M
) -> <Self as GenericUpscale2D<M>>::Output<Const<OH>, Const<OW>>where
Self: GenericUpscale2D<M>,
fn upscale2d<const OH: usize, const OW: usize, M: UpscaleMethod>( self, method: M ) -> <Self as GenericUpscale2D<M>>::Output<Const<OH>, Const<OW>>where Self: GenericUpscale2D<M>,
Upscale to compile time known dimensions.
sourcefn try_upscale2d<const OH: usize, const OW: usize, M: UpscaleMethod>(
self,
method: M
) -> Result<<Self as GenericUpscale2D<M>>::Output<Const<OH>, Const<OW>>, Self::Err>where
Self: GenericUpscale2D<M>,
fn try_upscale2d<const OH: usize, const OW: usize, M: UpscaleMethod>( self, method: M ) -> Result<<Self as GenericUpscale2D<M>>::Output<Const<OH>, Const<OW>>, Self::Err>where Self: GenericUpscale2D<M>,
Fallibly upscale to compile time known dimensions.
sourcefn upscale2d_like<OH: Dim, OW: Dim, M: UpscaleMethod>(
self,
method: M,
height: OH,
width: OW
) -> <Self as GenericUpscale2D<M>>::Output<OH, OW>where
Self: GenericUpscale2D<M>,
fn upscale2d_like<OH: Dim, OW: Dim, M: UpscaleMethod>( self, method: M, height: OH, width: OW ) -> <Self as GenericUpscale2D<M>>::Output<OH, OW>where Self: GenericUpscale2D<M>,
Upscale to runtime known dimensions.
sourcefn try_upscale2d_like<OH: Dim, OW: Dim, M: UpscaleMethod>(
self,
method: M,
height: OH,
width: OW
) -> Result<<Self as GenericUpscale2D<M>>::Output<OH, OW>, Self::Err>where
Self: GenericUpscale2D<M>,
fn try_upscale2d_like<OH: Dim, OW: Dim, M: UpscaleMethod>( self, method: M, height: OH, width: OW ) -> Result<<Self as GenericUpscale2D<M>>::Output<OH, OW>, Self::Err>where Self: GenericUpscale2D<M>,
Fallibly upscale to runtime known dimensions.