das.kapre.augmentation#
- class das.kapre.augmentation.AdditiveNoise(*args, **kwargs)[source]#
Adds Gaussian noise to the spectrogram.
Init.
- Parameters
power (float, optional) – Standard deviation of the noise. Defaults to 0.1.
random_gain (True, optional) – If
True
, gain is sampled fromuniform(low=0.0, high=power)
in every batch. Defaults to False.noise_type (str, optional) – Only supports white. Defaults to ‘white’.
- call(x)[source]#
This is where the layer’s logic lives.
The
call()
method may not create state (except in its first invocation, wrapping the creation of variables or other resources intf.init_scope()
). It is recommended to create state, includingtf.Variable
instances and nestedLayer
instances,in
__init__()
, or in thebuild()
method that iscalled automatically before
call()
executes for the first time.- Parameters
inputs –
Input tensor, or dict/list/tuple of input tensors. The first positional
inputs
argument is subject to special rules: -inputs
must be explicitly passed. A layer cannot have zeroarguments, and
inputs
cannot be provided via the default value of a keyword argument.NumPy array or Python scalar values in
inputs
get cast as tensors.Keras mask metadata is only collected from
inputs
.Layers are built (
build(input_shape)
method) using shape info frominputs
only.input_spec
compatibility is only checked againstinputs
.Mixed precision input casting is only applied to
inputs
. If a layer has tensor arguments in*args
or**kwargs
, their casting behavior in mixed precision should be handled manually.The SavedModel input specification is generated using
inputs
only.Integration with various ecosystem packages like TFMOT, TFLite, TF.js, etc is only supported for
inputs
and not for tensors in positional and keyword arguments.
*args – Additional positional arguments. May contain tensors, although this is not recommended, for the reasons above.
**kwargs –
Additional keyword arguments. May contain tensors, although this is not recommended, for the reasons above. The following optional keyword arguments are reserved: -
training
: Boolean scalar tensor of Python boolean indicatingwhether the
call
is meant for training or inference.mask
: Boolean input mask. If the layer’scall()
method takes amask
argument, its default value will be set to the mask generated forinputs
by the previous layer (ifinput
did come from a layer that generated a corresponding mask, i.e. if it came from a Keras layer with masking support).
- Returns
A tensor or list/tuple of tensors.
- get_config()[source]#
Returns the config of the layer.
A layer config is a Python dictionary (serializable) containing the configuration of a layer. The same layer can be reinstantiated later (without its trained weights) from this configuration.
The config of a layer does not include connectivity information, nor the layer class name. These are handled by
Network
(one layer of abstraction above).Note that
get_config()
does not guarantee to return a fresh copy of dict every time it is called. The callers should make a copy of the returned dict if they want to modify it.- Returns
Python dictionary.