@frozen
public struct SeparableConv2D<Scalar> : Layer where Scalar : TensorFlowFloatingPoint
A 2-D Separable convolution layer.
This layer performs a depthwise convolution that acts separately on channels followed by a pointwise convolution that mixes channels.
-
The 4-D depthwise convolution kernel.
Declaration
public var depthwiseFilter: Tensor<Scalar>
-
The 4-D pointwise convolution kernel.
Declaration
public var pointwiseFilter: Tensor<Scalar>
-
The bias vector.
Declaration
public var bias: Tensor<Scalar>
-
The element-wise activation function.
Declaration
@noDerivative public let activation: Activation
-
The strides of the sliding window for spatial dimensions.
Declaration
@noDerivative public let strides: (Int, Int)
-
The padding algorithm for convolution.
Declaration
@noDerivative public let padding: Padding
-
Creates a
SeparableConv2D
layer with the specified depthwise and pointwise filter, bias, activation function, strides, and padding.Declaration
public init( depthwiseFilter: Tensor<Scalar>, pointwiseFilter: Tensor<Scalar>, bias: Tensor<Scalar>? = nil, activation: @escaping Activation = identity, strides: (Int, Int) = (1, 1), padding: Padding = .valid )
Parameters
depthwiseFilter
The 4-D depthwise convolution kernel
[filter height, filter width, input channels count, channel multiplier]
.pointwiseFilter
The 4-D pointwise convolution kernel
[1, 1, channel multiplier * input channels count, output channels count]
.bias
The bias vector.
activation
The element-wise activation function.
strides
The strides of the sliding window for spatial dimensions.
padding
The padding algorithm for convolution.
-
init(depthwiseFilterShape:pointwiseFilterShape:strides:padding:activation:useBias:depthwiseFilterInitializer:pointwiseFilterInitializer:biasInitializer:)
Creates a
SeparableConv2D
layer with the specified depthwise and pointwise filter shape, strides, padding, and element-wise activation function.Declaration
public init( depthwiseFilterShape: (Int, Int, Int, Int), pointwiseFilterShape: (Int, Int, Int, Int), strides: (Int, Int) = (1, 1), padding: Padding = .valid, activation: @escaping Activation = identity, useBias: Bool = true, depthwiseFilterInitializer: ParameterInitializer<Scalar> = glorotUniform(), pointwiseFilterInitializer: ParameterInitializer<Scalar> = glorotUniform(), biasInitializer: ParameterInitializer<Scalar> = zeros() )
Parameters
depthwiseFilterShape
The shape of the 4-D depthwise convolution kernel.
pointwiseFilterShape
The shape of the 4-D pointwise convolution kernel.
strides
The strides of the sliding window for spatial/spatio-temporal dimensions.
padding
The padding algorithm for convolution.
activation
The element-wise activation function.
filterInitializer
Initializer to use for the filter parameters.
biasInitializer
Initializer to use for the bias parameters.