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

Fix unused variable warning. #485

Merged
merged 2 commits into from
Aug 26, 2019
Merged
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
9 changes: 5 additions & 4 deletions Tests/TensorFlowTests/LayerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -919,12 +919,13 @@ final class LayerTests: XCTestCase {
let x = Tensor<Float>(rangeFrom: 0, to: 20, stride: 1).reshaped(to: [4,5])
let epsilon = Tensor<Float>(0.001)
let bnLayer = BatchNorm<Float>(featureCount: 5, axis: 1, epsilon: epsilon)
// Test inferrence before any training is only changed by epsilon value.
// Test inference before any training.
assertEqual(bnLayer.inferring(from: x), x / TensorFlow.sqrt(1 + epsilon), accuracy: 1e-5)
// Test inferrence after single training step.
// Perform one training step, updating the running mean and variance.
Context.local.learningPhase = .training
let y = bnLayer(x)
// The expected values were computed using the following TensorFlow 2.0 Beta1 Python code :
_ = bnLayer(x) // This line is important and cannot be removed.
// Test inference after training step.
// The expected value was computed using the following Python code:
// ```
// x = tf.reshape(tf.range(20, dtype=tf.float32), [4,5])
// y_train = bnLayer(x, training=True)
Expand Down