Dilation2D

``````@frozen
public struct Dilation2D<Scalar> : Layer where Scalar : TensorFlowFloatingPoint``````

A 2-D morphological dilation layer

This layer returns the morphogical dilation of the input tensor with the provided filters

• ``` filter ```

The 4-D dilation filter.

Declaration

``public var filter: Tensor<Scalar>``
• ``` strides ```

The strides of the sliding window for spatial dimensions.

Declaration

``````@noDerivative
public let strides: (Int, Int)``````
• ``` padding ```

Declaration

``````@noDerivative
• ``` rates ```

The dilation factor for spatial dimensions.

Declaration

``````@noDerivative
public let rates: (Int, Int)``````
• ``` init(filter:strides:rates:padding:) ```

Creates a `Dilation2D` layer with the specified filter, strides, dilations and padding.

Declaration

``````public init(
filter: Tensor<Scalar>,
strides: (Int, Int) = (1, 1),
rates: (Int, Int) = (1, 1),
)``````

Parameters

 ``` filter ``` The 4-D dilation filter of shape [filter height, filter width, input channel count, output channel count]. ``` strides ``` The strides of the sliding window for spatial dimensions, i.e. (stride height, stride width). ``` rates ``` The dilation rates for spatial dimensions, i.e. (dilation height, dilation width). ``` padding ``` The padding algorithm for dilation.
• ``` forward(_:) ```

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

The output spatial dimensions are computed as:

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

Note

Padding size equals zero when using `.valid`.

Declaration

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

Parameters

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

Return Value

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

[]
[]