DepthwiseSeparableConvolutionLayer¶
A 1/2/3/N-D depthwise separable convolution layer.
See the "Convolution Layer" node for a general overview of convolutions and the "Depthwise Convolution Layer" node for a description of the depthwise variant. The depthwise separable variant is a further restriction of depthwise and is a highly factorized model. Besides being limited to 2 swept axes, a kernel is not a full learnable matrix but can be viewed as being generated as a product of a learnable horizontal and a learnable vertical weight vector, the result of which is applied like an (implicitly defined) highly redundant matrix (of rank 1). Note a potential point of confusion: Keras has a layer named Depthwise Separable Convolution, which is not a factorized convolution but a regular Depthwise Convolution followed by a 1x1 Convolution. More Info... Version 0.2.0
Ports/Properties¶
data¶
Data to process.
- verbose name: Data
- default value: None
- port type: DataPort
- value type: AnyNumeric (can be None)
- data direction: INOUT
mask¶
Mask to apply to the weights.
- verbose name: Mask
- default value: None
- port type: DataPort
- value type: AnyArray (can be None)
- data direction: IN
w_init¶
Initializer for the weights.
- verbose name: W Init
- default value: None
- port type: DataPort
- value type: BaseNode (can be None)
- data direction: IN
b_init¶
Initializer for the bias.
- verbose name: B Init
- default value: None
- port type: DataPort
- value type: BaseNode (can be None)
- data direction: IN
w_prior¶
Optional prior distribution for the weights.
- verbose name: W Prior
- default value: None
- port type: DataPort
- value type: Distribution (can be None)
- data direction: IN
b_prior¶
Optional prior distribution for the bias.
- verbose name: B Prior
- default value: None
- port type: DataPort
- value type: Distribution (can be None)
- data direction: IN
sweep_axes¶
List and order of axes over which the convolution filter kernel is swept. If the input data are packets, this determines the order of these axes in the output data, and the order of the axes in the kernel (for plain array inputs, see end of tooltip). A kernel is a learned array that is shifted over all possible positions in the data (optionally with step size in each dimension, and optionally going past the edges of the data by half the kernel size if padding=same). For each position, the kernel is multiplied by the data in the region covered by the kernel and the resulting (elementwise) product is integrated (summed) to produce a single output score (a measure of match between the kernel and the data in that region). If the input data has an extra feature axis, the kernel will usually have an implicit extra axis to hold weights for each input feature. If the data has an instance axis, each instance will be processed separately (using the same kernels). If the input data are plain arrays, this merely determines the number of spatial axes and the names are just mnemonic and not otherwise used. This can alternatively be given as just a number to set the number of spatial dimensions, corresponding to the N in N-D convolution; for packet data, this will resolve to the last N axes in the data that are neither feature nor instance axes. This parameter is not limited to the predefined options.
- verbose name: Axes To Sweep Kernel Over (Convolve)
- default value: time
- port type: ComboPort
- value type: str (can be None)
output_features¶
Number of filter kernels to learn for each input feature. This is a multiplier applied to the number of input features rather than the total number of output features. This value generally determines the length of the feature axis in the output data (each kernel yields one output feature per input feature, representing raw feature detection score produced by that kernel). In classic deep learning, this is also called the number of output channels -- analogous to RGB color channels in a raw image, or generally meant to be an unspecific feature axis in a data array (not to be confused with spatial channels in multi-channel time series, which more commonly treated like the vertical axis in 2d image data).
- verbose name: Filters Per Input Feature
- default value: 1
- port type: IntPort
- value type: int (can be None)
kernel_shape¶
Shape of the convolution filter kernel. This is a list of integers, one for each dimension as given in sweep axes. Can also be given as a single-element list, in which case the kernel is the same size along all of the given spatial dimensions. Note: if you make the kernel as large as the data along some axis, there is only a single valid position for the kernel along that axis (if padding=valid), and consequently the result is an inner product between the data and the kernel, or a matrix multiplication when more kernels are learned. Conversely, if you give the kernel a shape of 1 along an axis, the result is equivalent to processing each element along that axis separately using the same kernel. The latter is the same as not listing the axis in sweep axes, except that the output axis order can be controlled when specifying a 1-sized axis in sweep_axes. Which is more efficient depends on the implementation.
- verbose name: Kernel Shape
- default value: [3]
- port type: ListPort
- value type: list (can be None)
strides¶
Step size with which the kernel is swept over the data. This is a list of integers, one for each dimension as given in sweep axes. Can also be given as a single-element list, in which case the same step size is used along all of the specified spatial dimensions. A step size greater than 1 means that the kernel will be shifted by this amount between successive positions; as a result, the amount of compute is lower by this factor, and the output data along this axis will also be shorter by this factor (matching the number of positions at which the kernel is applied).
- verbose name: Step Size (Strides)
- default value: [1]
- port type: ListPort
- value type: list (can be None)
padding¶
Padding strategy for the data. This can be either 'valid' or 'same', or a custom list of padding amounts. 'valid' means no padding (i.e., the kernel will not run off the edges of the data, but the output data will be shorter along each axis according to the number of valid positions of the kernel along that axis), and 'same' means that the output will have the same shape as the input (aside from dilation and striding). Can be customized by giving a list[(low, high), ...] pairs, where low is the padding to apply before the data along each axis, and high is the padding to apply after the data along each axis. low and high can also be negative to trim the data instead of padding. If a single [(low, high)] pair is given, it is applied to all axes.
- verbose name: Padding
- default value: valid
- port type: ComboPort
- value type: str (can be None)
with_bias¶
Whether to include a bias term. If given, then for each output feature, a bias term is learned and added to the output of the convolution. This increases the flexibility of the learned model, but note that the result is no longer strictly equivalent to e.g., a learned FIR filter applied to time-series data or a learned spatial filter / matrix multiplication applied to spatial data.
- verbose name: Learn Bias Term(S)
- default value: True
- port type: BoolPort
- value type: bool (can be None)
w_initializer¶
Choice of weight initializer. This can either be one of the provided initializers, or the value "custom", in which case one of the Initializer nodes must be wired into the respective input port. For beginners it is recommended to stick to the defaults, since initialization of deep net layers is nuanced and can be tricky, otherwise be prepared to experiment with different choices. In general, the variance-scaling (lecun, glorot/xavier, he/kaiming) initializers are recommended, except for very simple/small layers where you may have a good default assumption as to the distribution of the weights (e.g., truncated_normal or uniform). Bias layers are typically zero-initialized. For initializers that take arguments, you can also type out the arguments positionally as in "truncated_normal(1.0,0.0)" (note reversed order of stddev, mean). The following initializers have arguments (here listed with their defaults): constant(value), those ending in normal(stddev=1, mean=0), those ending in uniform(min=0,max=1), orthogonal(scale=1,axis=-1), identity(gain=1), and variance_scaling(scale=1, "fan_in" (default)/"fan_avg"/"fan_out", "truncated_normal"(default)/"normal"/"uniform",optional-axis-indices=auto). Note that glorot and xavier are aliases for each other, and likewise he and kaiming are aliases for each other.
- verbose name: Weight Initializer
- default value: lecun_normal
- port type: ComboPort
- value type: str (can be None)
b_initializer¶
Choice of bias initializer. This can either be one of the provided initializers, or the value "custom", in which case one of the Initializer nodes must be wired into the respective input port. For beginners it is recommended to stick to the defaults, since initialization of deep net layers is nuanced and can be tricky, otherwise be prepared to experiment with different choices. In general, the variance-scaling (lecun, glorot/xavier, he/kaiming) initializers are recommended, except for very simple/small layers where you may have a good default assumption as to the distribution of the weights (e.g., truncated_normal or uniform). Bias layers are typically zero-initialized. For initializers that take arguments, you can also type out the arguments positionally as in "truncated_normal(1.0,0.0)" (note reversed order of stddev, mean). The following initializers have arguments (here listed with their defaults): constant(value), those ending in normal(stddev=1, mean=0), those ending in uniform(min=0,max=1), orthogonal(scale=1,axis=-1), identity(gain=1), and variance_scaling(scale=1, "fan_in" (default)/"fan_avg"/"fan_out", "truncated_normal"(default)/"normal"/"uniform",optional-axis-indices=auto). Note that glorot and xavier are aliases for each other, and likewise he and kaiming are aliases for each other.
- verbose name: Bias Initializer
- default value: zeros
- port type: ComboPort
- value type: str (can be None)
data_format¶
Format of the input data. This is only respected when working with plain arrays and is ignored for packet data, which always normalizes the data to 'channels_last' layout. If 'channels_last', the data is assumed to be in the format ({batch}, ..., channels). If 'channels_first', the data is assumed to be in the format ({batch}, channels, ...).
- verbose name: Array Data Format
- default value: auto
- port type: EnumPort
- value type: str (can be None)
op_precision¶
Operation precision. This is a compute performance optimization. See jax documentation for details on these options. Note that this only applies to the operation, while the storage precision may be separately configurable depending on the node in question.
- verbose name: Operation Precision
- default value: default
- port type: EnumPort
- value type: str (can be None)
layername¶
Name of the layer. Used for naming of weights.
- verbose name: Layer Name
- default value: separable_conv
- port type: StringPort
- value type: str (can be None)
set_breakpoint¶
Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.
- verbose name: Set Breakpoint (Debug Only)
- default value: False
- port type: BoolPort
- value type: bool (can be None)
metadata¶
User-definable meta-data associated with the node. Usually reserved for technical purposes.
- verbose name: Metadata
- default value: {}
- port type: DictPort
- value type: dict (can be None)