 
     thrust::copy(classes.begin(), classes.end(), Yt.begin());
 
-    *Y[t] = Yt;
+    std::stringstream ss;
+    ss << "Y" << t;
+    g[ss.str()] = Yt;
   }
 
+  std::cerr << "Graphviz step" << std::endl;
+  std::cout << g.graphviz() << std::endl;
+
+  std::cerr << "Forward step" << std::endl;
   g.forward(batch_size);
+  std::cerr << "Backward step" << std::endl;
   g.backward();
+  std::cerr << "Done" << std::endl;
 
-  std::cerr << graph.val().Debug() << std::endl;
+  std::cerr << g["graph"].val().Debug() << std::endl;
 
-  std::cerr << X[0]->val().Debug() << std::endl;
-  std::cerr << Y[0]->val().Debug() << std::endl;
+  std::cerr << g["X0"].val().Debug() << std::endl;
+  std::cerr << g["Y0"].val().Debug() << std::endl;
 
+#if 0
   std::cerr << Whh.grad().Debug() << std::endl;
   std::cerr << bh.grad().Debug() << std::endl;
   std::cerr << Why.grad().Debug() << std::endl;
   std::cerr << by.grad().Debug() << std::endl;
   std::cerr << Wxh.grad().Debug() << std::endl;
   std::cerr << h0.grad().Debug() << std::endl;
+#endif
 
   return 0;
 }


    thrust::copy(values.begin(), values.end(), Xt.begin());

    *X[t] = Xt;
  }

  for (int t = 0; t < num_outputs; ++t) {
    Tensor Yt({batch_size, output_size});

    std::vector<float> classes(batch_size * output_size, 0.0);



int main(int argc, char** argv) {

  ExpressionGraph g = build_graph(0);

  // For the stop symbol.
  for (int t = 0; t <= num_inputs; ++t) {
