Esempio n. 1
0
                      (len(features), len(nextMoves)))
                print(
                    "=========================================================="
                )

                batch = get_batch(features, nextMoves, BATCH_SIZE)
                while len(batch['features']) != 0:
                    # train 1 batch at a time:
                    network.train(batch)

                    if i % 5 == 0:
                        network.average_summary()

                    if i % 100 == 0 and i != 0:
                        network.save_checkpoint(CHECKPOINT_DIR,
                                                network.get_global_step())

                    # get rid of the data used in previous batch
                    # and get the next batch
                    features = features[BATCH_SIZE:]
                    nextMoves = nextMoves[BATCH_SIZE:]
                    batch = get_batch(features, nextMoves, BATCH_SIZE)
                    i += 1

                    print("%d batches ran. Remaining Feature Length is %d" %
                          (network.get_global_step(), len(features)))

                network.average_summary()

    print("%d batches ran." % i)