luz.transforms module¶
- class Argmax(dim=None, keepdim=False)¶
Bases:
luz.transforms.TensorTransform
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)¶
Transform tensor.
- Parameters
x (
Tensor
) – Input tensor.- Returns
Output tensor.
- Return type
torch.Tensor
- training: bool¶
- class Center(accumulate_along=None)¶
Bases:
luz.transforms.Scale
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- training: bool¶
- class Compose(*transforms)¶
Bases:
luz.transforms.TensorTransform
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- fit(dataset, key)¶
- forward(x)¶
Transform tensor.
- Parameters
x (
Any
) – Input tensor.- Returns
Output tensor.
- Return type
torch.Tensor
- inverse()¶
- Return type
- training: bool¶
- class Identity¶
Bases:
luz.transforms.TensorTransform
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)¶
Transform tensor.
- Parameters
x (
Tensor
) – Input tensor.- Returns
Output tensor, same as the input tensor.
- Return type
torch.Tensor
- inverse()¶
- Return type
- training: bool¶
- class Lookup(lookup_dict)¶
Bases:
luz.transforms.TensorTransform
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)¶
Transform tensor.
- Parameters
x – Input.
- Returns
Output tensor.
- Return type
torch.Tensor
- training: bool¶
- class NanToNum(*args, **kwargs)¶
Bases:
luz.transforms.TensorTransform
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Return type
Tensor
- training: bool¶
- class Normalize(accumulate_along=None)¶
Bases:
luz.transforms.Scale
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- training: bool¶
- class NormalizePerTensor(p, *args, **kwargs)¶
Bases:
luz.transforms.TensorTransform
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)¶
Transform tensor.
- Parameters
x (
Tensor
) – Input tensor.- Returns
Normalized output tensor.
- Return type
torch.Tensor
- training: bool¶
- class PowerSeries(degree, dim=- 1)¶
Bases:
luz.transforms.TensorTransform
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)¶
Transform tensor.
- Parameters
x (
Tensor
) – Input tensor.- Returns
Output tensor.
- Return type
torch.Tensor
- training: bool¶
- class Reshape(out_shape)¶
Bases:
luz.transforms.TensorTransform
Reshape tensor.
- Parameters
out_shape (
Iterable
[int
]) – Desired output shape.
- forward(x)¶
Transform tensor.
- Parameters
x (
Tensor
) – Input tensor.- Returns
Reshaped output tensor.
- Return type
torch.Tensor
- training: bool¶
- class Squeeze(dim)¶
Bases:
luz.transforms.TensorTransform
Squeeze tensor.
- Parameters
dim (
Optional
[int
]) – Dimension to be squeezed.
- forward(x)¶
Transform tensor.
- Parameters
x (
Tensor
) – Input tensor.- Returns
Squeezed output tensor.
- Return type
torch.Tensor
- inverse()¶
- Return type
- training: bool¶
- class Standardize(accumulate_along=None)¶
Bases:
luz.transforms.Scale
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- training: bool¶
- class TensorTransform¶
Bases:
torch.nn.modules.module.Module
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- inverse()¶
- Return type
- training: bool¶
- class Transform(**transforms)¶
Bases:
torch.nn.modules.module.Module
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- fit(dataset)¶
- forward(data)¶
Transform data.
- Parameters
data (
Data
) – Input data.- Returns
Output data.
- Return type
luz.Data
- training: bool¶
- class Transpose(dim0, dim1)¶
Bases:
luz.transforms.TensorTransform
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)¶
Transform tensor.
- Parameters
x (
Tensor
) – Input tensor.- Returns
Transposed output tensor.
- Return type
torch.Tensor
- inverse()¶
- Return type
- training: bool¶
- class Unsqueeze(dim)¶
Bases:
luz.transforms.TensorTransform
Unsqueeze tensor.
- Parameters
dim (
Optional
[int
]) – Dimension to be unsqueezed.
- forward(x)¶
Transform tensor.
- Parameters
x (
Tensor
) – Input tensor.- Returns
Unsqueezed output tensor.
- Return type
torch.Tensor
- inverse()¶
- Return type
- training: bool¶
- class YeoJohnson¶
Bases:
luz.transforms.TensorTransform
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- fit(dataset, key, batch_size=20)¶
- forward(x)¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Return type
Tensor
- training: bool¶
- class ZeroMeanPerTensor¶
Bases:
luz.transforms.TensorTransform
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)¶
Transform tensor.
- Parameters
x (
Tensor
) – Input tensor.- Returns
Output tensor.
- Return type
torch.Tensor
- training: bool¶