     }
 
     @differentiable
-    func applied(to input: Tensor<Float>, in context: Context) -> Tensor<Float> {
-        return l2.applied(to: l1.applied(to: input, in: context), in: context)
+    func applied(to input: Tensor<Float>) -> Tensor<Float> {
+        return input.sequenced(through: l1, l2)
     }
 }
 

) -> [Episode] {
    var observationNumpy = env.reset()

    let context = Context(learningPhase: .inference)
    var episodes: [Episode] = []

    // We build up a batch of observations and actions.

// let optimizer = SGD<Net, Float>(learningRate: 0.1, momentum: 0.9)
let optimizer = Adam<Net, Float>(learningRate: 0.01)
var batchIndex = 0
Context.local.learningPhase = .training
while true {
    print("Processing mini batch \(batchIndex)")
    batchIndex += 1
