torchwrench.nn.modules.tensor module¶
Module versions of tensor functions that do not already exists in PyTorch.
- class torchwrench.nn.modules.tensor.Abs(*args: Any, **kwargs: Any)[source]¶
Bases:
ModuleModule version of
abs().- forward(x: Tensor) Tensor[source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class torchwrench.nn.modules.tensor.Angle(*args: Any, **kwargs: Any)[source]¶
Bases:
ModuleModule version of
angle().- forward(x: Tensor) Tensor[source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class torchwrench.nn.modules.tensor.Exp(*args: Any, **kwargs: Any)[source]¶
Bases:
ModuleModule version of
exp().- forward(x: Tensor) Tensor[source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class torchwrench.nn.modules.tensor.Exp2(*args: Any, **kwargs: Any)[source]¶
Bases:
ModuleModule version of
exp2().- forward(x: Tensor) Tensor[source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class torchwrench.nn.modules.tensor.FFT(*args: Any, **kwargs: Any)[source]¶
Bases:
ModuleModule version of
fft().- forward(x: Tensor) Tensor[source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class torchwrench.nn.modules.tensor.IFFT(*args: Any, **kwargs: Any)[source]¶
Bases:
ModuleModule version of
ifft().- forward(x: Tensor) Tensor[source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
class torchwrench.nn.modules.tensor.Imag(*, return_zeros: bool =
False)[source]¶ Bases:
ModuleModule version of
imag().- forward(x: Tensor) Tensor[source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
class torchwrench.nn.modules.tensor.Interpolate(size: int | tuple[int, ...] | None =
None, scale_factor: float | tuple[float, ...] | None =None, mode: str ='nearest', align_corners: bool | None =None, recompute_scale_factor: bool | None =None, antialias: bool =False)[source]¶ Bases:
ModuleModule version of
interpolate().- forward(x: Tensor) Tensor[source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class torchwrench.nn.modules.tensor.Log(*args: Any, **kwargs: Any)[source]¶
Bases:
ModuleModule version of
log().- forward(x: Tensor) Tensor[source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class torchwrench.nn.modules.tensor.Log10(*args: Any, **kwargs: Any)[source]¶
Bases:
ModuleModule version of
log10().- forward(x: Tensor) Tensor[source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class torchwrench.nn.modules.tensor.Log2(*args: Any, **kwargs: Any)[source]¶
Bases:
ModuleModule version of
log2().- forward(x: Tensor) Tensor[source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
class torchwrench.nn.modules.tensor.Max(dim: int | None =
None, keepdim: bool =False, *, return_values: bool =True, return_indices: bool | None =None)[source]¶ Bases:
ModuleModule version of
max().- extra_repr() str[source]¶
Return the extra representation of the module.
To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.
- forward(x: Tensor) Tensor | max[source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
class torchwrench.nn.modules.tensor.Mean(dim: int | None =
None, keepdim: bool =False, dtype: dtype | None | 'default' | str | DTypeEnum =None)[source]¶ Bases:
ModuleModule version of
mean().- extra_repr() str[source]¶
Return the extra representation of the module.
To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.
- forward(x: Tensor) Tensor[source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
class torchwrench.nn.modules.tensor.Min(dim: int | None =
None, keepdim: bool =False, *, return_values: bool =True, return_indices: bool | None =None)[source]¶ Bases:
ModuleModule version of
min().- extra_repr() str[source]¶
Return the extra representation of the module.
To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.
- forward(x: Tensor) Tensor | min[source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
class torchwrench.nn.modules.tensor.Normalize(p: float =
2.0, dim: int =1, eps: float =1e-12)[source]¶ Bases:
ModuleModule version of
normalize().- extra_repr() str[source]¶
Return the extra representation of the module.
To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.
- forward(x: Tensor) Tensor[source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class torchwrench.nn.modules.tensor.Permute(*args: int)[source]¶
Bases:
ModuleModule version of
permute().- extra_repr() str[source]¶
Return the extra representation of the module.
To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.
- forward(x: Tensor) Tensor[source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class torchwrench.nn.modules.tensor.Pow(exponent: int | float | bool | Tensor)[source]¶
Bases:
ModuleModule version of
pow().- extra_repr() str[source]¶
Return the extra representation of the module.
To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.
- forward(x: Tensor) Tensor[source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class torchwrench.nn.modules.tensor.Real(*args: Any, **kwargs: Any)[source]¶
Bases:
ModuleModule version of
real().- forward(x: Tensor) Tensor[source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class torchwrench.nn.modules.tensor.Repeat(*repeats: int)[source]¶
Bases:
ModuleModule version of
repeat().- extra_repr() str[source]¶
Return the extra representation of the module.
To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.
- forward(x: Tensor) Tensor[source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
class torchwrench.nn.modules.tensor.RepeatInterleave(repeats: int | Tensor, dim: int, output_size: int | None =
None)[source]¶ Bases:
ModuleModule version of
repeat_interleave().- extra_repr() str[source]¶
Return the extra representation of the module.
To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.
- forward(x: Tensor) Tensor[source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class torchwrench.nn.modules.tensor.Reshape(*shape: int)[source]¶
Bases:
ModuleModule version of
reshape().- extra_repr() str[source]¶
Return the extra representation of the module.
To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.
- forward(x: Tensor) Tensor[source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
class torchwrench.nn.modules.tensor.Sort(dim: int =
-1, descending: bool =False, *, return_values: bool =True, return_indices: bool =True)[source]¶ Bases:
ModuleModule version of
sort().- forward(x: Tensor) sort | Tensor[source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class torchwrench.nn.modules.tensor.TensorTo(**kwargs)[source]¶
Bases:
ModuleModule version of
to().- extra_repr() str[source]¶
Return the extra representation of the module.
To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.
- forward(x: Tensor) Tensor[source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class torchwrench.nn.modules.tensor.ToList(*args: Any, **kwargs: Any)[source]¶
Bases:
ModuleModule version of
tolist().- forward(x: Tensor) list[source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
class torchwrench.nn.modules.tensor.Transpose(dim0: int, dim1: int, copy: bool =
False)[source]¶ Bases:
ModuleModule version of
transpose().- extra_repr() str[source]¶
Return the extra representation of the module.
To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.
- forward(x: Tensor) Tensor[source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class torchwrench.nn.modules.tensor.View(dtype: dtype, /)[source]¶
- class torchwrench.nn.modules.tensor.View(size: Sequence[int], /)
- class torchwrench.nn.modules.tensor.View(*size: int)
Bases:
Module- forward(x: Tensor) Tensor[source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.