Run for one step
(network, X_batch, y_batch, cost=None, acc=None)
| 673 | |
| 674 | # @tf.function # FIXME : enable tf.function will cause some bugs in numpy, need fixing |
| 675 | def _run_step(network, X_batch, y_batch, cost=None, acc=None): |
| 676 | """Run for one step""" |
| 677 | y_pred = network(X_batch) |
| 678 | _loss, _acc = None, None |
| 679 | if cost is not None: |
| 680 | _loss = cost(y_pred, y_batch) |
| 681 | if acc is not None: |
| 682 | _acc = acc(y_pred, y_batch) |
| 683 | return _loss, _acc |