estimators
Classes:
Name | Description |
---|---|
Estimator |
Defines an interface for estimating noise components from input values. |
PatchEstimator |
Defines an interface for estimating noise components using non-overlapping 2D convolutions over input image(s). |
Estimator
¶
Bases: Generic[ModuleT, OptionalParameterizationT, OptionalMaskerT]
, Module
Defines an interface for estimating noise components from input values.
Estimator
s should return a tensor of a broadcastable shape to the input tensor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
ModuleT
|
The module to use to estimate the unparameterized noise component. |
required |
|
str
|
The name of the parameter to pass the input tensor as to the |
required |
|
OptionalParameterizationT
|
The optional parameterization to apply to the output of |
None
|
|
OptionalMaskerT
|
The optional masker to apply to the output of the |
None
|
Added in version 0.37.0.
Methods:
Name | Description |
---|---|
__call__ |
Estimate noise components from input values. |
forward |
Estimate noise components from input values. |
reset_parameters |
Reinitialize parameters and buffers. |
__call__
¶
__call__(
input: Tensor,
noise_mask: Tensor | None = None,
**kwargs: Any,
) -> tuple[torch.Tensor, torch.Tensor | None]
__call__(
input: Tensor,
noise_mask: Tensor | None = None,
**kwargs: Any,
) -> tuple[torch.Tensor, torch.Tensor | None]
__call__(
input: Tensor,
noise_mask: Tensor | None = None,
**kwargs: Any,
) -> tuple[torch.Tensor, torch.Tensor | None]
__call__(
input: Tensor,
noise_mask: Tensor | None = None,
**kwargs: Any,
) -> tuple[torch.Tensor, torch.Tensor | None]
Estimate noise components from input values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Tensor
|
The tensor to estimate noise components from. |
required |
|
Tensor | None
|
An optional mask tensor to use to select a subset of the elements of the estimated standard deviations for computing
a mask to apply to the input. If |
None
|
|
Any
|
Additional keyword arguments to |
required |
Returns:
Type | Description |
---|---|
tuple[torch.Tensor, torch.Tensor | None]
|
A tuple containing the estimated noise components and an input mask if there is a |
forward
¶
forward(
input: Tensor,
noise_mask: Tensor | None = None,
**kwargs: Any,
) -> tuple[torch.Tensor, torch.Tensor | None]
Estimate noise components from input values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Tensor
|
The tensor to estimate noise components from. |
required |
|
Tensor | None
|
An optional mask tensor to use to select a subset of the elements of the estimated standard deviations for computing
a mask to apply to the input. If |
None
|
|
Any
|
Additional keyword arguments to |
required |
Returns:
Type | Description |
---|---|
tuple[torch.Tensor, torch.Tensor | None]
|
A tuple containing the estimated noise components and an input mask if there is a |
reset_parameters
¶
Reinitialize parameters and buffers.
This method is useful for initializing tensors created on the meta device.
PatchEstimator
¶
Bases: Estimator[Conv2d, OptionalParameterizationT, OptionalMaskerT]
Defines an interface for estimating noise components using non-overlapping 2D convolutions over input image(s).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Conv2d
|
The 2D convolutional module to use. The estimator must have a stride equal to its kernel size (non-overlapping) and output channels equal to the input channels times the product of the kernel side lengths (input volume = output volume). |
required |
|
str
|
The name of the parameter to pass the input tensor as to the |
'input'
|
|
OptionalParameterizationT
|
The optional parameterization to apply to the output of the estimator. |
None
|
|
OptionalMaskerT
|
The optional masker to apply to the output of the parameterization. |
None
|
|
Literal['constant', 'reflect', 'replicate', 'circular']
|
Type of padding. One of: constant, reflect, replicate, or circular. |
'constant'
|
|
float
|
Fill value for constant padding. |
0.0
|
Raises:
Type | Description |
---|---|
ValueError
|
If the stride is not equal to the kernel size. |
ValueError
|
If the output channels are not equal to the input channels times the product of the kernel side lengths. |
ValueError
|
If a non-zero padding value is given for a padding mode other than constant. |
Added in version 0.40.0.
Methods:
Name | Description |
---|---|
__call__ |
Estimate noise components from input values. |
forward |
Estimate noise components from input values. |
module_from_input_shape |
Construct a non-overlapping Conv2d from the given parameters. |
reset_parameters |
Reinitialize parameters and buffers. |
__call__
¶
__call__(
input: Tensor,
noise_mask: Tensor | None = None,
**kwargs: Any,
) -> tuple[torch.Tensor, torch.Tensor | None]
__call__(
input: Tensor,
noise_mask: Tensor | None = None,
**kwargs: Any,
) -> tuple[torch.Tensor, torch.Tensor | None]
__call__(
input: Tensor,
noise_mask: Tensor | None = None,
**kwargs: Any,
) -> tuple[torch.Tensor, torch.Tensor | None]
__call__(
input: Tensor,
noise_mask: Tensor | None = None,
**kwargs: Any,
) -> tuple[torch.Tensor, torch.Tensor | None]
Estimate noise components from input values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Tensor
|
The tensor to estimate noise components from. |
required |
|
Tensor | None
|
An optional mask tensor to use to select a subset of the elements of the estimated standard deviations for computing
a mask to apply to the input. If |
None
|
|
Any
|
Additional keyword arguments to |
required |
Returns:
Type | Description |
---|---|
tuple[torch.Tensor, torch.Tensor | None]
|
A tuple containing the estimated noise components and an input mask if there is a |
forward
¶
forward(
input: Tensor,
noise_mask: Tensor | None = None,
**kwargs: Any,
) -> tuple[torch.Tensor, torch.Tensor | None]
Estimate noise components from input values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Tensor
|
The tensor to estimate noise components from. |
required |
|
Tensor | None
|
An optional mask tensor to use to select a subset of the elements of the estimated standard deviations for computing
a mask to apply to the input. If |
None
|
|
Any
|
Additional keyword arguments to |
required |
Returns:
Type | Description |
---|---|
tuple[torch.Tensor, torch.Tensor | None]
|
A tuple containing the estimated noise components and an input mask if there is a |
module_from_input_shape
staticmethod
¶
module_from_input_shape(
color_channels: int,
patch_size: int | tuple[int, int] | Sequence[int],
) -> nn.Conv2d
Construct a non-overlapping Conv2d from the given parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
int
|
The number of color channels in the input image(s). |
required |
|
int | tuple[int, int] | Sequence[int]
|
The dimension of the non-overlapping rectangular patches to tile the image with; if a single value is given, a square patch will be used. |
required |
Returns:
Type | Description |
---|---|
nn.Conv2d
|
The constructed Conv2d. |
reset_parameters
¶
Reinitialize parameters and buffers.
This method is useful for initializing tensors created on the meta device.