     //
     // @differentiable(wrt: (self, input), vjp: _vjpApplied(to:))
     // public func applied(to input: Tensor<Scalar>) -> Tensor<Scalar> {
-    //     if mode.training {
+    //     if learningPhaseIndicator.training {
     //         return applyTraining(to: input)
     //     } else {
     //         return applyInference(to: input)

/// In typical uses, every layer in a model that has behavior which differs
/// between training and inference shares an instance of ModeRef so it doesn't
/// need to be toggled or threaded through in more than one place.
public class ModeRef {
    public var training: Bool = true
}


public struct Dropout<Scalar>: Layer
    where Scalar: BinaryFloatingPoint & Differentiable & TensorFlowScalar,
          Scalar.RawSignificand : FixedWidthInteger {
    @noDerivative public let probability: Double
    @noDerivative public let learningPhaseIndicator: LearningPhaseIndicator
    // Workaround for TF-8
    var _unused: Tensor<Scalar>

    public init(
        probability: Double,
        learningPhaseIndicator: LearningPhaseIndicator
    ) {
        self.probability = probability
        self.learningPhaseIndicator = learningPhaseIndicator
        // Workaround for TF-8
        self._unused = Tensor<Scalar>(0)
    }

    @differentiable(wrt: (self, input))
    func applyTraining(to input: Tensor<Scalar>) -> Tensor<Scalar> {
        return input.droppedOut(withProbability: probability)
    }

    @differentiable(wrt: (self, input))
    func applyInference(to input: Tensor<Scalar>) -> Tensor<Scalar> {
        return input
    }

    @differentiable(wrt: (self, input), vjp: _vjpApplied(to:))
    public func applied(to input: Tensor<Scalar>) -> Tensor<Scalar> {
        if learningPhaseIndicator.training {
            return applyTraining(to: input)
        } else {
            return applyInference(to: input)
