cvnets.neural_augmentor.utils package
Submodules
cvnets.neural_augmentor.utils.neural_aug_utils module
- class cvnets.neural_augmentor.utils.neural_aug_utils.Clip(min_val: float, max_val: float, hard_clip: bool | None = False, *args, **kwargs)[source]
Bases:
Module
- __init__(min_val: float, max_val: float, hard_clip: bool | None = False, *args, **kwargs) None [source]
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Any) Any [source]
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.
- class cvnets.neural_augmentor.utils.neural_aug_utils.Identity(*args, **kwargs)[source]
Bases:
Module
- __init__(*args, **kwargs)[source]
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- forward(x: Any) Any [source]
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.
- class cvnets.neural_augmentor.utils.neural_aug_utils.FixedSampler(value: float, clip_fn: Module | None = Identity(), *args, **kwargs)[source]
Bases:
Module
- __init__(value: float, clip_fn: Module | None = Identity(), *args, **kwargs)[source]
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- forward(sample_shape=(), data_type=torch.float32, device=device(type='cpu')) Tensor [source]
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.
- class cvnets.neural_augmentor.utils.neural_aug_utils.UniformSampler(low: float, high: float, min_fn: Module | None = Identity(), max_fn: Module | None = Identity(), *args, **kwargs)[source]
Bases:
Module
- __init__(low: float, high: float, min_fn: Module | None = Identity(), max_fn: Module | None = Identity(), *args, **kwargs)[source]
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- forward(sample_shape=(), data_type=torch.float32, device=device(type='cpu')) Tensor [source]
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.
- property high
- property low
- cvnets.neural_augmentor.utils.neural_aug_utils.random_noise(x: Tensor, variance: Tensor, *args, **kwargs) Tensor [source]
Apply random noise sampled.
- cvnets.neural_augmentor.utils.neural_aug_utils.random_contrast(x: Tensor, magnitude: Tensor, *args, **kwargs) Tensor [source]