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

Add default argument for conv2D dilations #286

Merged
merged 1 commit into from
Jun 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sources/TensorFlow/Operators/NN.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public func conv2D<Scalar: TensorFlowFloatingPoint>(
filter: Tensor<Scalar>,
strides: (Int, Int, Int, Int),
padding: Padding,
dilations: (Int, Int, Int, Int)
dilations: (Int, Int, Int, Int) = (1, 1, 1, 1)
) -> Tensor<Scalar> {
return Raw.conv2D(
input,
Expand Down Expand Up @@ -200,7 +200,7 @@ func conv2DBackpropFilter<Scalar: TensorFlowFloatingPoint>(
filterSizes: Tensor<Int32>,
strides: (Int, Int, Int, Int),
padding: Padding,
dilations: (Int, Int, Int, Int)
dilations: (Int, Int, Int, Int) = (1, 1, 1, 1)
) -> Tensor<Scalar> {
return Raw.conv2DBackpropFilter(
input,
Expand Down
4 changes: 2 additions & 2 deletions Tests/TensorFlowTests/LayerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final class LayerTests: XCTestCase {
let filter = Tensor<Float>(ones: [3, 1, 2]) * Tensor<Float>([[[0.5, 1]]])
let bias = Tensor<Float>([0, 1])
let layer = Conv1D<Float>(filter: filter, bias: bias, activation: identity, stride: 1,
padding: .valid, dilation: 1)
padding: .valid)
let input = Tensor<Float>([[0, 1, 2, 3, 4], [10, 11, 12, 13, 14]]).expandingShape(at: 2)
let output = layer.inferring(from: input)
let expected = Tensor<Float>(
Expand Down Expand Up @@ -55,7 +55,7 @@ final class LayerTests: XCTestCase {
let filter = Tensor(shape: [1, 2, 2, 1], scalars: (0..<4).map(Float.init))
let bias = Tensor<Float>([1, 2])
let layer = Conv2D<Float>(filter: filter, bias: bias, activation: identity,
strides: (2, 2), padding: .valid, dilations: (1, 1))
strides: (2, 2), padding: .valid)
let input = Tensor(shape: [2, 2, 2, 2], scalars: (0..<16).map(Float.init))
let output = layer.inferring(from: input)
let expected = Tensor<Float>(shape: [2, 1, 1, 2],
Expand Down