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

A 3-D convolution layer for spatial/spatio-temporal convolution over images.

This layer creates a convolution filter that is convolved with the layer input to produce a tensor of outputs.

  • The 5-D convolution filter.

    Declaration

    public var filter: 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, Int)
  • The padding algorithm for convolution.

    Declaration

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

    Declaration

    public typealias Activation = (Tensor<Scalar>) -> Tensor<Scalar>
  • Creates a Conv3D layer with the specified filter, bias, activation function, strides, and padding.

    Declaration

    public init(
        filter: Tensor<Scalar>,
        bias: Tensor<Scalar>,
        activation: @escaping Activation = identity,
        strides: (Int, Int, Int) = (1, 1, 1),
        padding: Padding = .valid
    )

    Parameters

    filter

    The 5-D convolution filter of shape [filter depth, filter height, filter width, input channel count, output channel count].

    bias

    The bias vector of shape [output channel count].

    activation

    The element-wise activation function.

    strides

    The strides of the sliding window for spatial dimensions, i.e. (stride depth, stride height, stride width)

    padding

    The padding algorithm for convolution.

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

    The output spatial dimensions are computed as:

    output depth = (input depth + 2 * padding depth - (dilation depth * (filter depth - 1) + 1)) / stride depth + 1

    output height = (input height + 2 * padding height - (dilation height * (filter height - 1) + 1)) / stride height + 1

    output width = (input width + 2 * padding width - (dilation width * (filter width - 1) + 1)) / stride width + 1

    and padding sizes are determined by the padding scheme.

    Note

    Padding size equals zero when using .valid.

    Declaration

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

    Parameters

    input

    The input to the layer of shape [batch count, input depth, input height, input width, input channel count].

    Return Value

    The output of shape [batch count, output depth, output height, output width, output channel count].

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

    Declaration

    init(
        filterShape: (Int, Int, Int, Int, Int),
        strides: (Int, Int, Int) = (1, 1, 1),
        padding: Padding = .valid,
        activation: @escaping Activation = identity,
        filterInitializer: ParameterInitializer<Scalar> = glorotUniform(),
        biasInitializer: ParameterInitializer<Scalar> = zeros()
    )

    Parameters

    filterShape

    The shape of the 5-D convolution filter, representing (filter depth, filter height, filter width, input channel count, output channel count).

    strides

    The strides of the sliding window for spatial dimensions, i.e. (stride depth, stride height, stride width)

    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.