     }
 }
 
-/// A mutable, shareable reference to a tensor
-public final class Parameter<T: TensorFlowScalar> {
-    public var value: Tensor<T>
-    public init(_ value: Tensor<T>) {
+/// A mutable, shareable, owning reference to a tensor.
+public final class Parameter<Scalar: TensorFlowScalar> {
+    public var value: Tensor<Scalar>
+    public init(_ value: Tensor<Scalar>) {
         self.value = value
     }
 }
 
+/// A densely-connected neural network layer.
+///
+/// `Dense` implements the operation `activation(matmul(input, weight) + bias)` where `activation`
+/// is the element-wise activation function passed as the activation argument. `weight` is a weight
+/// matrix created by the layer, and `bias` is a bias vector created by the layer.
 @_fixed_layout
 public struct Dense<Scalar: TensorFlowFloatingPoint>: Layer {
     public var weight: Tensor<Scalar>


    @differentiable(wrt: (self, input))
    public func applied(to input: Tensor<Scalar>, in _: Context) -> Tensor<Scalar> {
        let batchSize = input.shape[0]
        let height = input.shape[1]
        let width = input.shape[2]
        let channels = input.shape[3]
        let reshapeSize = Tensor<Int32>([batchSize, height, 1, width, 1, channels])
        let scaleOnes = Tensor<Scalar>(ones: [1, 1, size, 1, size, 1])
        let upSampling = input.reshaped(toShape: reshapeSize) * scaleOnes
        let upSampledShape = Tensor<Int32>([batchSize, height * size, width * size, channels])
        let upSampled = upSampling.reshaped(toShape: upSampledShape)
        return upSampled
    }
}

}

public extension Dense where Scalar.RawSignificand: FixedWidthInteger {
    init<G: RandomNumberGenerator>(
        inputSize: Int,
        outputSize: Int,
        activation: @escaping Activation,
        generator: inout G
    ) {
        self.init(weight: Tensor(glorotUniform: [Int32(inputSize), Int32(outputSize)],
                                 generator: &generator),
                  bias: Tensor(zeros: [Int32(outputSize)]),
                  activation: activation)
    }

    init(inputSize: Int, outputSize: Int, activation: @escaping Activation) {
      self.init(inputSize: inputSize, outputSize: outputSize, activation: activation,
                generator: &PhiloxRandomNumberGenerator.global)
    }
}

