title: How to train model with TensorflowSharp
body: <p>I am new with TensorfolwSharp.  I see some examples about how to load model and predict using TensorfolwSharp.  But I cannot find examples to train model using TensorfolwSharp.  I give it a try and stuck at Optimizer now.  Too many parameters for ApplyAdam, not even sure this is the right function to use.</p>
  
  <p>Following is my WORKING Tensorflow code.</p>
  
  <pre><code>dataX = pd.read_csv('dataX.csv', sep = ',', header = None)
  dataX = pd.read_csv('dataY.csv', sep = ',', header = None)  
  x = tf.placeholder(tf.float32, [None, trainX.shape[1]]) 
  y = tf.placeholder(tf.float32, [None, 1]) 
  W0 = tf.Variable(tf.random_normal([trainX.shape[1], h0size], seed = seed))
  b0 = tf.Variable(tf.random_normal([h0size], seed = seed))
  h = tf.matmul(x, W0) + b0
  pred = tf.sigmoid(h)
  cost = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(labels = y, logits = h))
  optimizer = tf.train.AdamOptimizer(learning_rate).minimize(cost)
  with tf.Session() as sess:
      sess.run(init)
      for epoch in range(50):
          _, c = sess.run([optimizer, cost], feed_dict ={x: dataX, y: dataX})
  </code></pre>
  
  <p>Following is my attemp to convert to TensorflowSharp</p>
  
  <pre><code>        using (var session = new TFSession())
          {
              var graph = session.Graph;
              //dataX = pd.read_csv('dataX.csv', sep = ',', header = None)
              //dataY = pd.read_csv('dataY.csv', sep = ',', header = None)
              float[,] aX = LoadCsv("dataX.csv");
              float[,] aY = LoadCsv("dataY.csv");
              TFTensor dataX = new TFTensor(aX);
              TFTensor dataY = new TFTensor(aY);
              //x = tf.placeholder(tf.float32, [None, trainX.shape[1]]) 
              //y = tf.placeholder(tf.float32, [None, 1]) 
              var x = graph.Placeholder(TFDataType.Float, new TFShape(dataX.Shape));
              var y = graph.Placeholder(TFDataType.Float, new TFShape(dataY.Shape));
              var W0 = graph.Variable(graph.RandomNormal(new TFShape(dataX.Shape[1], 1)));
              var b0 = graph.Variable(graph.RandomNormal(new TFShape(1)));
              var h = graph.Add(graph.MatMul(x, W0), b0);
              var pred = graph.Sigmoid(h);
              var cost = graph.ReduceMean(graph.SigmoidCrossEntropyWithLogits(y,h));
              //optimizer = tf.train.AdamOptimizer(learning_rate).minimize(cost)
              // Too many parameters for ApplyAdam, not even sure this is the right function to use. 
              TFOutput var, m = 0, v = 0, beta1_power, beta2_power, lr = 0.01, beta1 = 0.9, beta2 = 0.999, epsilon = 0.00000001, grad;
              var optimizer = graph.ApplyAdam(var, m, v, beta1_power, beta2_power, lr, beta1, beta2, epsilon, grad);
              for (int i = 0; i &lt; 50 ; i++)
                  session.GetRunner().Run(
                      inputs: new[] { optimizer },
                      inputValues: new[] { dataX, dataY }
                      );
  }
  </code></pre>