<commit_before>const assert = require('chai').assert;
const tf = require('../../index');
const _ = require('lodash');
const mnist_data = require('mnist-data');
require('pyextjs'); const np = window.numpy;

class MnistData {
  next_batch() { return [1, 2]; }
}

class Mnist {
  constructor(train_count, test_count) {
    this.train = new MnistData(mnist_data.training(train_count));
    this.test = new MnistData(mnist_data.testing(test_count));
  }
}

describe("Tensorflow training", function() {

  describe("mnist", function() {
    it("should load mnist dataset", function() {
      const mnist = new Mnist(1000, 100);

      const g = new tf.Graph();
      const x = g.input(tf.float32, [-1, 784]);
      const W = g.variable(np.zeros([784, 10]));
      const b = g.variable(np.zeros([10]));

      const y = g.nn.softmax(g.add(g.matmul(x, W), b));
      const y_ = g.input(tf.float32, [-1, 10]);

      cross_entropy = g.reduce_mean(-g.reduce_sum(y_ * g.log(y), {reduction_indices: [1]}))
      train_step = g.train.GradientDescentOptimizer(0.5); // .minimize(cross_entropy)

      // init = g.variable_initializers();
      // sess = new tf.Session(g);
      // sess.run(init);

      // _.times(10, () => {
      //   [batch_xs, batch_ys] = mnist.train.next_batch(100);
      //   sess.run(train_step, [[x, batch_xs], [y_, batch_ys]]);
 
      //   // correct_prediction = tf.equal(tf.argmax(y,1), tf.argmax(y_,1));
      //   // accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32));
      //   // console.log(sess.run(accuracy, feed_dict={x: mnist.test.images, y_: mnist.test.labels}));
      // })
    });
  });
});<commit_msg>Stubbed out tests<commit_after>const assert = require('chai').assert;
const tf = require('../../index');
const _ = require('lodash');
const mnist_data = require('mnist-data');
require('pyextjs'); const np = window.numpy;

class MnistData {
  next_batch() { return [1, 2]; }
}

class Mnist {
  constructor(train_count, test_count) {
    this.train = new MnistData(mnist_data.training(train_count));
    this.test = new MnistData(mnist_data.testing(test_count));
  }
}

describe("Tensorflow training", function() {

  describe("mnist", function() {
    it("should load mnist dataset", function() {
      const mnist = new Mnist(1000, 100);

      const g = new tf.Graph();
      const x = g.input(tf.float32, [-1, 784]);
      const W = g.variable(np.zeros([784, 10]));
      const b = g.variable(np.zeros([10]));

      const y = g.nn.softmax(g.add(g.matmul(x, W), b));
      const y_ = g.input(tf.float32, [-1, 10]);

      cross_entropy = g.reduce_mean(-g.reduce_sum(y_ * g.log(y), {reduction_indices: [1]}))
      // train_step = g.train.GradientDescentOptimizer(0.5).minimize(cross_entropy)

      // init = g.variable_initializers();
      sess = new tf.Session(g);
      // sess.run(init);

      _.times(10, () => {
        [batch_xs, batch_ys] = mnist.train.next_batch(100);
        // sess.run(train_step, [[x, batch_xs], [y_, batch_ys]]);
 
        // correct_prediction = tf.equal(tf.argmax(y,1), tf.argmax(y_,1));
        // accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32));
        // console.log(sess.run(accuracy, feed_dict={x: mnist.test.images, y_: mnist.test.labels}));
      })
    });
  });
});
{'fraction_non_alphanumeric': 0.18927156354769886, 'fraction_numerical': 0.023773239865894545, 'mean_word_length': 3.159695817490494, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5153620', 'n_tokens_mistral': 1271, 'n_tokens_neox': 1187, 'n_words': 213}