FIR module
- class nnodely.layers.fir.Fir(*args, **kwargs)[source]
Represents a Finite Impulse Response (FIR) relation in the neural network model.
Notes
Note
The FIR relation works along the time dimension (second dimension) of the input tensor. You can find some initialization functions inside the initializer module.
- Parameters:
output_dimension (int, optional) – The output dimension of the FIR relation.
W_init (Callable, str, optional) – A callable for initializing the parameters.
W_init_params (dict, optional) – A dictionary of parameters for the parameter initializer.
b_init (Callable, str, optional) – A callable for initializing the bias.
b_init_params (dict, optional) – A dictionary of parameters for the bias initializer.
W (Parameter or str, optional) – The parameter object or tag. The parameter can be defined using the relative class ‘Parameter’. If not given a new parameter will be auto-generated.
b (bool, str, or Parameter, optional) – The bias parameter object, tag, or a boolean indicating whether to use bias. If set to ‘True’ a new parameter will be auto-generated.
dropout (int or float, optional) – The dropout rate. Default is 0.
- relation_name
The name of the relation.
- Type:
str
- W_init
The parameter initializer.
- Type:
Callable
- W_init_params
The parameters for the parameter initializer.
- Type:
dict
- b_init
The bias initializer.
- Type:
Callable
- b_init_params
The parameters for the bias initializer.
- Type:
dict
- b
The bias object, name, or a boolean indicating whether to use bias.
- Type:
bool, str, or Parameter
- pname
The name of the parameter.
- Type:
str
- bname
The name of the bias.
- Type:
str
- dropout
The dropout rate.
- Type:
int or float
- output_dimension
The output dimension of the FIR relation.
- Type:
int
Examples
Basic usage:
input = Input('in') relation = Fir(input.tw(0.05))
Passing a parameter:
input = Input('in') par = Parameter('par', dimensions=3, sw=2, init='init_constant') relation = Fir(W=par)(input.sw(2))
Parameters initialization:
x = Input('x') F = Input('F') fir_x = Fir(W_init='init_negexp')(x.tw(0.2)) fir_F = Fir(W_init='init_constant', W_init_params={'value':1})(F.last())
For more examples of how to use the FIR module, please refer to the FIR tutorial.