Skip to content
This repository was archived by the owner on Jul 1, 2023. It is now read-only.

Commit 56d5c1b

Browse files
jon-towrxwei
authored andcommitted
Add default argument for conv2D dilations (#286)
1 parent ef3af7a commit 56d5c1b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Sources/TensorFlow/Operators/NN.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public func conv2D<Scalar: TensorFlowFloatingPoint>(
123123
filter: Tensor<Scalar>,
124124
strides: (Int, Int, Int, Int),
125125
padding: Padding,
126-
dilations: (Int, Int, Int, Int)
126+
dilations: (Int, Int, Int, Int) = (1, 1, 1, 1)
127127
) -> Tensor<Scalar> {
128128
return Raw.conv2D(
129129
input,
@@ -200,7 +200,7 @@ func conv2DBackpropFilter<Scalar: TensorFlowFloatingPoint>(
200200
filterSizes: Tensor<Int32>,
201201
strides: (Int, Int, Int, Int),
202202
padding: Padding,
203-
dilations: (Int, Int, Int, Int)
203+
dilations: (Int, Int, Int, Int) = (1, 1, 1, 1)
204204
) -> Tensor<Scalar> {
205205
return Raw.conv2DBackpropFilter(
206206
input,

Tests/TensorFlowTests/LayerTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ final class LayerTests: XCTestCase {
2020
let filter = Tensor<Float>(ones: [3, 1, 2]) * Tensor<Float>([[[0.5, 1]]])
2121
let bias = Tensor<Float>([0, 1])
2222
let layer = Conv1D<Float>(filter: filter, bias: bias, activation: identity, stride: 1,
23-
padding: .valid, dilation: 1)
23+
padding: .valid)
2424
let input = Tensor<Float>([[0, 1, 2, 3, 4], [10, 11, 12, 13, 14]]).expandingShape(at: 2)
2525
let output = layer.inferring(from: input)
2626
let expected = Tensor<Float>(
@@ -55,7 +55,7 @@ final class LayerTests: XCTestCase {
5555
let filter = Tensor(shape: [1, 2, 2, 1], scalars: (0..<4).map(Float.init))
5656
let bias = Tensor<Float>([1, 2])
5757
let layer = Conv2D<Float>(filter: filter, bias: bias, activation: identity,
58-
strides: (2, 2), padding: .valid, dilations: (1, 1))
58+
strides: (2, 2), padding: .valid)
5959
let input = Tensor(shape: [2, 2, 2, 2], scalars: (0..<16).map(Float.init))
6060
let output = layer.inferring(from: input)
6161
let expected = Tensor<Float>(shape: [2, 1, 1, 2],

0 commit comments

Comments
 (0)