无法解释Tensorflow图的memory_profiler结果

时间:2018-08-27 04:00:55

标签: python tensorflow memory-profiling

我已经从memory_profiler中获得了与this问题类似的输出。问题脚本是一个简单的Tensorflow循环,用于训练神经网络。我不确定在内存使用情况下“增量”列下的负值应该表示什么,尤其是因为它们似乎并不伴随总内存使用情况的变化(“内存使用情况”)。

Line #    Mem usage    Increment   Line Contents
================================================
   176    423.5 MiB    423.5 MiB   @profile()
   177                             def learning_fcn():
   178                                 global errors
   179                                 global rg_out
   180                                 global yhat
   181   8742.0 MiB -11505.6 MiB       for i in range(NUM_EPOCHS):
   182   8742.0 MiB -931882.3 MiB           for start, end in zip(range(0, len(trainx_rg), MINI_BATCH_SIZE), range(MINI_BATCH_SIZE, len(trainx_rg), MINI_BATCH_SIZE)):
   183   8742.0 MiB -920308.5 MiB               sess.run([train_op_mse, extra_update_ops], feed_dict={X_1D_init: np.sort(trainx_rg[start:end]), X_2D_init: np.sort(np.reshape(trainx_rg[start:end], (MBS_DIM, MBS_DIM))), _t: 1.0,
   184   8742.0 MiB -920457.2 MiB                                   _K: Kparam})
   185   8742.0 MiB -11747.2 MiB           mse = sess.run(tf.nn.l2_loss(yhat - rg_out), feed_dict={X_1D_init: np.sort(validx_rg[test_num * MINI_BATCH_SIZE: (test_num + 1) * MINI_BATCH_SIZE]), \
   186   8742.0 MiB  -3089.1 MiB                              X_2D_init: np.reshape(validx_rg[test_num * MINI_BATCH_SIZE: (test_num + 1) * MINI_BATCH_SIZE],(MBS_DIM, MBS_DIM)), _t: 1.0, _K: Kparam})
   187   8742.0 MiB -11505.5 MiB           errors.append(mse)
   188   8742.0 MiB -11505.0 MiB           if i % 100 == 0: print "epoch %d, validation MSE %g" % (i, mse)
   189   8726.2 MiB    -15.8 MiB       return yhat

任何帮助将不胜感激!

0 个答案:

没有答案
相关问题