SeparableConv1D

@frozen
public struct SeparableConv1D<Scalar> : Layer where Scalar : TensorFlowFloatingPoint

A 1-D separable convolution layer.

This layer performs a depthwise convolution that acts separately on channels followed by a pointwise convolution that mixes channels.

  • The 3-D depthwise convolution kernel.

    Declaration

    public var depthwiseFilter: Tensor<Scalar>
  • The 3-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 stride: Int
  • The padding algorithm for convolution.

    Declaration

    @noDerivative
    public let padding: Padding
  • The element-wise activation function type.

    Declaration

    public typealias Activation = @differentiable (Tensor<Scalar>) -> Tensor<Scalar>
  • Creates a SeparableConv1D 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,
      stride: Int = 1,
      padding: Padding = .valid
    )

    Parameters

    depthwiseFilter

    The 3-D depthwise convolution kernel [filter width, input channels count, channel multiplier].

    pointwiseFilter

    The 3-D pointwise convolution kernel [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.

  • Returns the output obtained from applying the layer to the given input.

    Declaration

    @differentiable
    public func forward(_ input: Tensor<Scalar>) -> Tensor<Scalar>

    Parameters

    input

    The input to the layer.

    Return Value

    The output.

  • Creates a SeparableConv1D layer with the specified depthwise and pointwise filter shape, strides, padding, and element-wise activation function.

    Declaration

    public init(
      depthwiseFilterShape: (Int, Int, Int),
      pointwiseFilterShape: (Int, Int, Int),
      stride: Int = 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 3-D depthwise convolution kernel.

    pointwiseFilterShape

    The shape of the 3-D pointwise convolution kernel.

    strides

    The strides of the sliding window for 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.