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

Commit c7595c4

Browse files
authored
Fix unused variable warning. (#485)
Note that the call to `BatchNorm.callAsFunction` cannot be removed because it updates running mean and variance.
1 parent 89f6104 commit c7595c4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Tests/TensorFlowTests/LayerTests.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -975,12 +975,13 @@ final class LayerTests: XCTestCase {
975975
let x = Tensor<Float>(rangeFrom: 0, to: 20, stride: 1).reshaped(to: [4,5])
976976
let epsilon = Tensor<Float>(0.001)
977977
let bnLayer = BatchNorm<Float>(featureCount: 5, axis: 1, epsilon: epsilon)
978-
// Test inferrence before any training is only changed by epsilon value.
978+
// Test inference before any training.
979979
assertEqual(bnLayer.inferring(from: x), x / TensorFlow.sqrt(1 + epsilon), accuracy: 1e-5)
980-
// Test inferrence after single training step.
980+
// Perform one training step, updating the running mean and variance.
981981
Context.local.learningPhase = .training
982-
let y = bnLayer(x)
983-
// The expected values were computed using the following TensorFlow 2.0 Beta1 Python code :
982+
_ = bnLayer(x) // This line is important and cannot be removed.
983+
// Test inference after training step.
984+
// The expected value was computed using the following Python code:
984985
// ```
985986
// x = tf.reshape(tf.range(20, dtype=tf.float32), [4,5])
986987
// y_train = bnLayer(x, training=True)

0 commit comments

Comments
 (0)