From a686a76eccf5d44d21aec4af9544c22655aa73f4 Mon Sep 17 00:00:00 2001 From: Anthony Platanios Date: Tue, 2 Apr 2019 08:17:10 -0400 Subject: [PATCH 1/9] Updated the convolution ops to support explicit paddings. --- Sources/DeepLearning/Operators.swift | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/Sources/DeepLearning/Operators.swift b/Sources/DeepLearning/Operators.swift index 51b2406a8..3a660c07a 100644 --- a/Sources/DeepLearning/Operators.swift +++ b/Sources/DeepLearning/Operators.swift @@ -98,12 +98,14 @@ public extension Tensor where Scalar: BinaryFloatingPoint { } //===------------------------------------------------------------------------------------------===// -// Convolution and pooling +// Convolution and Pooling //===------------------------------------------------------------------------------------------===// /// A padding scheme. Used by padding, convolution, and pooling ops. // @_frozen // SR-9739 public enum Padding { + /// The "explicit" padding scheme. + case explicit(_ paddings: [Int32]) /// The "valid" padding scheme. case valid /// The "same" padding scheme. @@ -112,12 +114,22 @@ public enum Padding { public extension Padding { @inlinable - var raw: Raw.Padding { + var raw: Raw.Padding2 { switch self { + case .explicit: return .explicit case .same: return .same case .valid: return .valid } } + + @inlinable + internal var explicitPaddings: [Int32] { + switch self { + case .explicit(let paddings): return paddings + case .same: return [] + case .valid: return [] + } + } } public extension Tensor where Scalar: TensorFlowFloatingPoint { @@ -135,7 +147,8 @@ public extension Tensor where Scalar: TensorFlowFloatingPoint { filter: filter, outBackprop: self, strides: [strides.0, strides.1, strides.2, strides.3], - padding: padding.raw) + padding: padding.raw, + explicitPaddings: padding.explicitPaddings) } /// TensorFlow builtin conv2d gradient helper for the filter. @@ -152,7 +165,8 @@ public extension Tensor where Scalar: TensorFlowFloatingPoint { filterSizes: filterSizes, outBackprop: self, strides: [strides.0, strides.1, strides.2, strides.3], - padding: padding.raw) + padding: padding.raw, + explicitPaddings: padding.explicitPaddings) } @inlinable @@ -282,7 +296,8 @@ public extension Tensor where Scalar: FloatingPoint { self, filter: filter, strides: [strides.0, strides.1, strides.2, strides.3], - padding: padding.raw) + padding: padding.raw, + explicitPaddings: padding.explicitPaddings) } /// Computes a 2-D max pooling, with the specified kernel sizes, strides, and From 8494c04d0ef849119b73cd566bccb304bb11a999 Mon Sep 17 00:00:00 2001 From: Anthony Platanios Date: Tue, 2 Apr 2019 08:22:58 -0400 Subject: [PATCH 2/9] Small fix. --- Sources/DeepLearning/Operators.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/DeepLearning/Operators.swift b/Sources/DeepLearning/Operators.swift index 3a660c07a..501722a9e 100644 --- a/Sources/DeepLearning/Operators.swift +++ b/Sources/DeepLearning/Operators.swift @@ -105,7 +105,7 @@ public extension Tensor where Scalar: BinaryFloatingPoint { // @_frozen // SR-9739 public enum Padding { /// The "explicit" padding scheme. - case explicit(_ paddings: [Int32]) + case explicit([Int32]) /// The "valid" padding scheme. case valid /// The "same" padding scheme. From 5dfaaeecf5b48e4784ec2c3b9c0607f2bb7ceced Mon Sep 17 00:00:00 2001 From: Anthony Platanios Date: Tue, 2 Apr 2019 08:32:29 -0400 Subject: [PATCH 3/9] Added documentation string for the "explicit" padding scheme. --- Sources/DeepLearning/Operators.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/DeepLearning/Operators.swift b/Sources/DeepLearning/Operators.swift index 501722a9e..827890b3d 100644 --- a/Sources/DeepLearning/Operators.swift +++ b/Sources/DeepLearning/Operators.swift @@ -104,7 +104,8 @@ public extension Tensor where Scalar: BinaryFloatingPoint { /// A padding scheme. Used by padding, convolution, and pooling ops. // @_frozen // SR-9739 public enum Padding { - /// The "explicit" padding scheme. + /// The "explicit" padding scheme, which is defined by an array indicating the explicit padding + /// sizes at the start and end of each dimension. case explicit([Int32]) /// The "valid" padding scheme. case valid From eda9514edf0884d1da3545bf9417005a1a2fc1b7 Mon Sep 17 00:00:00 2001 From: Anthony Platanios Date: Tue, 2 Apr 2019 21:24:34 -0400 Subject: [PATCH 4/9] More fixes. --- Sources/DeepLearning/Layer.swift | 20 ++++++++++---------- Sources/DeepLearning/Operators.swift | 23 +++++++++++++++++++++-- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/Sources/DeepLearning/Layer.swift b/Sources/DeepLearning/Layer.swift index 7c4cf1d23..ffa83d6b9 100644 --- a/Sources/DeepLearning/Layer.swift +++ b/Sources/DeepLearning/Layer.swift @@ -836,7 +836,7 @@ public struct MaxPool1D: Layer { /// The stride of the sliding window for temporal dimension. @noDerivative let stride: Int32 /// The padding algorithm for pooling. - @noDerivative let padding: Padding + @noDerivative let padding: PaddingV1 /// Creates a max pooling layer. /// @@ -847,7 +847,7 @@ public struct MaxPool1D: Layer { public init( poolSize: Int, stride: Int, - padding: Padding + padding: PaddingV1 ) { self.poolSize = Int32(poolSize) self.stride = Int32(stride) @@ -878,13 +878,13 @@ public struct MaxPool2D: Layer { /// Strides in non-spatial dimensions must be `1`. @noDerivative let strides: (Int32, Int32, Int32, Int32) /// The padding algorithm for pooling. - @noDerivative let padding: Padding + @noDerivative let padding: PaddingV1 /// Creates a max pooling layer. public init( poolSize: (Int, Int, Int, Int), strides: (Int, Int, Int, Int), - padding: Padding + padding: PaddingV1 ) { (self.poolSize.0, self.poolSize.1, self.poolSize.2, self.poolSize.3) = (Int32(poolSize.0), Int32(poolSize.1), Int32(poolSize.2), Int32(poolSize.3)) @@ -899,7 +899,7 @@ public struct MaxPool2D: Layer { /// - poolSize: Vertical and horizontal factors by which to downscale. /// - strides: The strides. /// - padding: The padding. - public init(poolSize: (Int, Int), strides: (Int, Int), padding: Padding = .valid) { + public init(poolSize: (Int, Int), strides: (Int, Int), padding: PaddingV1 = .valid) { self.poolSize = (1, Int32(poolSize.0), Int32(poolSize.1), 1) self.strides = (1, Int32(strides.0), Int32(strides.1), 1) self.padding = padding @@ -927,7 +927,7 @@ public struct AvgPool1D: Layer { /// The stride of the sliding window for temporal dimension. @noDerivative let stride: Int32 /// The padding algorithm for pooling. - @noDerivative let padding: Padding + @noDerivative let padding: PaddingV1 /// Creates an average pooling layer. /// @@ -938,7 +938,7 @@ public struct AvgPool1D: Layer { public init( poolSize: Int, stride: Int, - padding: Padding + padding: PaddingV1 ) { self.poolSize = Int32(poolSize) self.stride = Int32(stride) @@ -969,13 +969,13 @@ public struct AvgPool2D: Layer { /// Strides in non-spatial dimensions must be `1`. @noDerivative let strides: (Int32, Int32, Int32, Int32) /// The padding algorithm for pooling. - @noDerivative let padding: Padding + @noDerivative let padding: PaddingV1 /// Creates a average pooling layer. public init( poolSize: (Int, Int, Int, Int), strides: (Int, Int, Int, Int), - padding: Padding + padding: PaddingV1 ) { (self.poolSize.0, self.poolSize.1, self.poolSize.2, self.poolSize.3) = (Int32(poolSize.0), Int32(poolSize.1), Int32(poolSize.2), Int32(poolSize.3)) @@ -990,7 +990,7 @@ public struct AvgPool2D: Layer { /// - poolSize: Vertical and horizontal factors by which to downscale. /// - strides: The strides. /// - padding: The padding. - public init(poolSize: (Int, Int), strides: (Int, Int), padding: Padding = .valid) { + public init(poolSize: (Int, Int), strides: (Int, Int), padding: PaddingV1 = .valid) { self.poolSize = (1, Int32(poolSize.0), Int32(poolSize.1), 1) self.strides = (1, Int32(strides.0), Int32(strides.1), 1) self.padding = padding diff --git a/Sources/DeepLearning/Operators.swift b/Sources/DeepLearning/Operators.swift index 3a660c07a..1587facbd 100644 --- a/Sources/DeepLearning/Operators.swift +++ b/Sources/DeepLearning/Operators.swift @@ -132,6 +132,25 @@ public extension Padding { } } +/// An older padding scheme. Used by padding, convolution, and pooling ops. +// @_frozen // SR-9739 +public enum PaddingV1 { + /// The "valid" padding scheme. + case valid + /// The "same" padding scheme. + case same +} + +public extension PaddingV1 { + @inlinable + var raw: Raw.Padding { + switch self { + case .same: return .same + case .valid: return .valid + } + } +} + public extension Tensor where Scalar: TensorFlowFloatingPoint { /// TensorFlow builtin conv2d gradient helper for the input. @inlinable @@ -316,7 +335,7 @@ public extension Tensor where Scalar: FloatingPoint { func maxPooled( kernelSize: (Int32, Int32, Int32, Int32), strides: (Int32, Int32, Int32, Int32), - padding: Padding + padding: PaddingV1 ) -> Tensor { return Raw.maxPoolV2( self, @@ -343,7 +362,7 @@ public extension Tensor where Scalar: FloatingPoint { func averagePooled( kernelSize: (Int32, Int32, Int32, Int32), strides: (Int32, Int32, Int32, Int32), - padding: Padding + padding: PaddingV1 ) -> Tensor { return Raw.avgPool( value: self, From 4cb01984ab0e7bcae0be14e7d83bbd9fbffbbf8f Mon Sep 17 00:00:00 2001 From: Anthony Platanios Date: Tue, 2 Apr 2019 21:29:08 -0400 Subject: [PATCH 5/9] One more fix. --- Sources/DeepLearning/Operators.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/DeepLearning/Operators.swift b/Sources/DeepLearning/Operators.swift index b942ede53..2f15ee570 100644 --- a/Sources/DeepLearning/Operators.swift +++ b/Sources/DeepLearning/Operators.swift @@ -251,7 +251,7 @@ public extension Tensor where Scalar: TensorFlowFloatingPoint { internal func _vjpMaxPooled( kernelSize: (Int32, Int32, Int32, Int32), strides: (Int32, Int32, Int32, Int32), - padding: Padding + padding: PaddingV1 ) -> (Tensor, (Tensor) -> Tensor) { // TODO: Currently this is not higher order differentiable. Redefine in // closed form. @@ -273,7 +273,7 @@ public extension Tensor where Scalar: TensorFlowFloatingPoint { internal func _vjpAveragePooled( kernelSize: (Int32, Int32, Int32, Int32), strides: (Int32, Int32, Int32, Int32), - padding: Padding + padding: PaddingV1 ) -> (Tensor, (Tensor) -> Tensor) { // TODO: Currently this is not higher order differentiable. Redefine in // closed form. From ef9bbe6c0bb86f38ad49a042e795e90ff0285c24 Mon Sep 17 00:00:00 2001 From: Anthony Platanios Date: Tue, 2 Apr 2019 21:32:00 -0400 Subject: [PATCH 6/9] Made some more fixes to the convolution and pooling ops. --- Sources/DeepLearning/Layer.swift | 2 +- Sources/DeepLearning/Operators.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/DeepLearning/Layer.swift b/Sources/DeepLearning/Layer.swift index ffa83d6b9..2e294b659 100644 --- a/Sources/DeepLearning/Layer.swift +++ b/Sources/DeepLearning/Layer.swift @@ -616,7 +616,7 @@ public struct TransposedConv2D: Layer { self.activation = activation (self.strides.0, self.strides.1) = (Int32(strides.0), Int32(strides.1)) self.padding = padding - self.paddingIndex = padding == .same ? 0 : 1 + self.paddingIndex = padding == Padding.same ? 0 : 1 } /// Returns the output obtained from applying the layer to the given input. diff --git a/Sources/DeepLearning/Operators.swift b/Sources/DeepLearning/Operators.swift index 2f15ee570..6df3b8e6b 100644 --- a/Sources/DeepLearning/Operators.swift +++ b/Sources/DeepLearning/Operators.swift @@ -103,7 +103,7 @@ public extension Tensor where Scalar: BinaryFloatingPoint { /// A padding scheme. Used by padding, convolution, and pooling ops. // @_frozen // SR-9739 -public enum Padding { +public enum Padding: Equatable { /// The "explicit" padding scheme, which is defined by an array indicating the explicit padding /// sizes at the start and end of each dimension. case explicit([Int32]) From a72ed91414a4e7eb9154adf7edca856b93d63d72 Mon Sep 17 00:00:00 2001 From: Anthony Platanios Date: Tue, 2 Apr 2019 21:47:24 -0400 Subject: [PATCH 7/9] Fixed a merge error. --- Sources/DeepLearning/Layer.swift | 2 +- Sources/DeepLearning/Operators.swift | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/Sources/DeepLearning/Layer.swift b/Sources/DeepLearning/Layer.swift index 2e294b659..ffa83d6b9 100644 --- a/Sources/DeepLearning/Layer.swift +++ b/Sources/DeepLearning/Layer.swift @@ -616,7 +616,7 @@ public struct TransposedConv2D: Layer { self.activation = activation (self.strides.0, self.strides.1) = (Int32(strides.0), Int32(strides.1)) self.padding = padding - self.paddingIndex = padding == Padding.same ? 0 : 1 + self.paddingIndex = padding == .same ? 0 : 1 } /// Returns the output obtained from applying the layer to the given input. diff --git a/Sources/DeepLearning/Operators.swift b/Sources/DeepLearning/Operators.swift index 53c30d29a..6df3b8e6b 100644 --- a/Sources/DeepLearning/Operators.swift +++ b/Sources/DeepLearning/Operators.swift @@ -146,20 +146,10 @@ public extension PaddingV1 { @inlinable var raw: Raw.Padding { switch self { - case .explicit: return .explicit case .same: return .same case .valid: return .valid } } - - @inlinable - internal var explicitPaddings: [Int32] { - switch self { - case .explicit(let paddings): return paddings - case .same: return [] - case .valid: return [] - } - } } public extension Tensor where Scalar: TensorFlowFloatingPoint { From 94dfd36a20b43e09ab56dde40b7eb5e0af16d293 Mon Sep 17 00:00:00 2001 From: Anthony Platanios Date: Tue, 2 Apr 2019 21:51:32 -0400 Subject: [PATCH 8/9] Removed support for explicit paddings. --- Sources/DeepLearning/Layer.swift | 20 ++++++------ Sources/DeepLearning/Operators.swift | 48 +++++----------------------- 2 files changed, 18 insertions(+), 50 deletions(-) diff --git a/Sources/DeepLearning/Layer.swift b/Sources/DeepLearning/Layer.swift index ffa83d6b9..7c4cf1d23 100644 --- a/Sources/DeepLearning/Layer.swift +++ b/Sources/DeepLearning/Layer.swift @@ -836,7 +836,7 @@ public struct MaxPool1D: Layer { /// The stride of the sliding window for temporal dimension. @noDerivative let stride: Int32 /// The padding algorithm for pooling. - @noDerivative let padding: PaddingV1 + @noDerivative let padding: Padding /// Creates a max pooling layer. /// @@ -847,7 +847,7 @@ public struct MaxPool1D: Layer { public init( poolSize: Int, stride: Int, - padding: PaddingV1 + padding: Padding ) { self.poolSize = Int32(poolSize) self.stride = Int32(stride) @@ -878,13 +878,13 @@ public struct MaxPool2D: Layer { /// Strides in non-spatial dimensions must be `1`. @noDerivative let strides: (Int32, Int32, Int32, Int32) /// The padding algorithm for pooling. - @noDerivative let padding: PaddingV1 + @noDerivative let padding: Padding /// Creates a max pooling layer. public init( poolSize: (Int, Int, Int, Int), strides: (Int, Int, Int, Int), - padding: PaddingV1 + padding: Padding ) { (self.poolSize.0, self.poolSize.1, self.poolSize.2, self.poolSize.3) = (Int32(poolSize.0), Int32(poolSize.1), Int32(poolSize.2), Int32(poolSize.3)) @@ -899,7 +899,7 @@ public struct MaxPool2D: Layer { /// - poolSize: Vertical and horizontal factors by which to downscale. /// - strides: The strides. /// - padding: The padding. - public init(poolSize: (Int, Int), strides: (Int, Int), padding: PaddingV1 = .valid) { + public init(poolSize: (Int, Int), strides: (Int, Int), padding: Padding = .valid) { self.poolSize = (1, Int32(poolSize.0), Int32(poolSize.1), 1) self.strides = (1, Int32(strides.0), Int32(strides.1), 1) self.padding = padding @@ -927,7 +927,7 @@ public struct AvgPool1D: Layer { /// The stride of the sliding window for temporal dimension. @noDerivative let stride: Int32 /// The padding algorithm for pooling. - @noDerivative let padding: PaddingV1 + @noDerivative let padding: Padding /// Creates an average pooling layer. /// @@ -938,7 +938,7 @@ public struct AvgPool1D: Layer { public init( poolSize: Int, stride: Int, - padding: PaddingV1 + padding: Padding ) { self.poolSize = Int32(poolSize) self.stride = Int32(stride) @@ -969,13 +969,13 @@ public struct AvgPool2D: Layer { /// Strides in non-spatial dimensions must be `1`. @noDerivative let strides: (Int32, Int32, Int32, Int32) /// The padding algorithm for pooling. - @noDerivative let padding: PaddingV1 + @noDerivative let padding: Padding /// Creates a average pooling layer. public init( poolSize: (Int, Int, Int, Int), strides: (Int, Int, Int, Int), - padding: PaddingV1 + padding: Padding ) { (self.poolSize.0, self.poolSize.1, self.poolSize.2, self.poolSize.3) = (Int32(poolSize.0), Int32(poolSize.1), Int32(poolSize.2), Int32(poolSize.3)) @@ -990,7 +990,7 @@ public struct AvgPool2D: Layer { /// - poolSize: Vertical and horizontal factors by which to downscale. /// - strides: The strides. /// - padding: The padding. - public init(poolSize: (Int, Int), strides: (Int, Int), padding: PaddingV1 = .valid) { + public init(poolSize: (Int, Int), strides: (Int, Int), padding: Padding = .valid) { self.poolSize = (1, Int32(poolSize.0), Int32(poolSize.1), 1) self.strides = (1, Int32(strides.0), Int32(strides.1), 1) self.padding = padding diff --git a/Sources/DeepLearning/Operators.swift b/Sources/DeepLearning/Operators.swift index 6df3b8e6b..ab136e372 100644 --- a/Sources/DeepLearning/Operators.swift +++ b/Sources/DeepLearning/Operators.swift @@ -103,10 +103,7 @@ public extension Tensor where Scalar: BinaryFloatingPoint { /// A padding scheme. Used by padding, convolution, and pooling ops. // @_frozen // SR-9739 -public enum Padding: Equatable { - /// The "explicit" padding scheme, which is defined by an array indicating the explicit padding - /// sizes at the start and end of each dimension. - case explicit([Int32]) +public enum Padding { /// The "valid" padding scheme. case valid /// The "same" padding scheme. @@ -114,35 +111,6 @@ public enum Padding: Equatable { } public extension Padding { - @inlinable - var raw: Raw.Padding2 { - switch self { - case .explicit: return .explicit - case .same: return .same - case .valid: return .valid - } - } - - @inlinable - internal var explicitPaddings: [Int32] { - switch self { - case .explicit(let paddings): return paddings - case .same: return [] - case .valid: return [] - } - } -} - -/// An older padding scheme. Used by padding, convolution, and pooling ops. -// @_frozen // SR-9739 -public enum PaddingV1 { - /// The "valid" padding scheme. - case valid - /// The "same" padding scheme. - case same -} - -public extension PaddingV1 { @inlinable var raw: Raw.Padding { switch self { @@ -168,7 +136,7 @@ public extension Tensor where Scalar: TensorFlowFloatingPoint { outBackprop: self, strides: [strides.0, strides.1, strides.2, strides.3], padding: padding.raw, - explicitPaddings: padding.explicitPaddings) + explicitPaddings: []) } /// TensorFlow builtin conv2d gradient helper for the filter. @@ -186,7 +154,7 @@ public extension Tensor where Scalar: TensorFlowFloatingPoint { outBackprop: self, strides: [strides.0, strides.1, strides.2, strides.3], padding: padding.raw, - explicitPaddings: padding.explicitPaddings) + explicitPaddings: []) } @inlinable @@ -251,7 +219,7 @@ public extension Tensor where Scalar: TensorFlowFloatingPoint { internal func _vjpMaxPooled( kernelSize: (Int32, Int32, Int32, Int32), strides: (Int32, Int32, Int32, Int32), - padding: PaddingV1 + padding: Padding ) -> (Tensor, (Tensor) -> Tensor) { // TODO: Currently this is not higher order differentiable. Redefine in // closed form. @@ -273,7 +241,7 @@ public extension Tensor where Scalar: TensorFlowFloatingPoint { internal func _vjpAveragePooled( kernelSize: (Int32, Int32, Int32, Int32), strides: (Int32, Int32, Int32, Int32), - padding: PaddingV1 + padding: Padding ) -> (Tensor, (Tensor) -> Tensor) { // TODO: Currently this is not higher order differentiable. Redefine in // closed form. @@ -317,7 +285,7 @@ public extension Tensor where Scalar: FloatingPoint { filter: filter, strides: [strides.0, strides.1, strides.2, strides.3], padding: padding.raw, - explicitPaddings: padding.explicitPaddings) + explicitPaddings: []) } /// Computes a 2-D max pooling, with the specified kernel sizes, strides, and @@ -336,7 +304,7 @@ public extension Tensor where Scalar: FloatingPoint { func maxPooled( kernelSize: (Int32, Int32, Int32, Int32), strides: (Int32, Int32, Int32, Int32), - padding: PaddingV1 + padding: Padding ) -> Tensor { return Raw.maxPoolV2( self, @@ -363,7 +331,7 @@ public extension Tensor where Scalar: FloatingPoint { func averagePooled( kernelSize: (Int32, Int32, Int32, Int32), strides: (Int32, Int32, Int32, Int32), - padding: PaddingV1 + padding: Padding ) -> Tensor { return Raw.avgPool( value: self, From b9f6a47df3c6ee9189ba942ec240fc571009b2d1 Mon Sep 17 00:00:00 2001 From: Anthony Platanios Date: Wed, 3 Apr 2019 16:00:34 -0400 Subject: [PATCH 9/9] Final fix. --- Sources/DeepLearning/Operators.swift | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Sources/DeepLearning/Operators.swift b/Sources/DeepLearning/Operators.swift index ab136e372..e7a0b2ade 100644 --- a/Sources/DeepLearning/Operators.swift +++ b/Sources/DeepLearning/Operators.swift @@ -112,7 +112,15 @@ public enum Padding { public extension Padding { @inlinable - var raw: Raw.Padding { + internal var raw: Raw.Padding { + switch self { + case .same: return .same + case .valid: return .valid + } + } + + @inlinable + internal var raw2: Raw.Padding2 { switch self { case .same: return .same case .valid: return .valid @@ -135,7 +143,7 @@ public extension Tensor where Scalar: TensorFlowFloatingPoint { filter: filter, outBackprop: self, strides: [strides.0, strides.1, strides.2, strides.3], - padding: padding.raw, + padding: padding.raw2, explicitPaddings: []) } @@ -153,7 +161,7 @@ public extension Tensor where Scalar: TensorFlowFloatingPoint { filterSizes: filterSizes, outBackprop: self, strides: [strides.0, strides.1, strides.2, strides.3], - padding: padding.raw, + padding: padding.raw2, explicitPaddings: []) } @@ -284,7 +292,7 @@ public extension Tensor where Scalar: FloatingPoint { self, filter: filter, strides: [strides.0, strides.1, strides.2, strides.3], - padding: padding.raw, + padding: padding.raw2, explicitPaddings: []) }