sess.run有什么问题?没有结果

时间:2017-10-09 02:29:39

标签: python session tensorflow

我想将一个测试样本测试成一个图表,但不幸的是,我什么也没得到。如果我只是把批量大小的测试样品,结果很好,为什么呢?此外,如果我只是多次复制一个测试样本,结果也没有。

x_reconstruction = sess.run(t.x_r, feed_dict={t.z_r: z_batch})
x_reconstruction[0]
Out[42]:
array([ -1.00000000e+00, -1.00000000e+00, -1.00000000e+00,
-1.00000000e+00, -1.00000000e+00, -1.00000000e+00,
-1.00000000e+00, -1.00000000e+00, -1.00000000e+00,
-1.00000000e+00, -1.00000000e+00, -1.00000000e+00,
-1.00000000e+00, -1.00000000e+00, -1.00000000e+00,
-1.00000000e+00, -1.00000000e+00, -1.00000000e+00,
-1.00000000e+00, -1.00000000e+00, -1.00000000e+00,
-1.00000000e+00, -1.00000000e+00, -1.00000000e+00,
-1.00000000e+00, -1.00000000e+00, -1.00000000e+00,

我只是从z_batch获取测试样本,运行图形

x_reconstruction_1 = sess.run(t.x_r, feed_dict={t.z_r: z_batch[0].reshape(1,2)})
x_reconstruction_1
Out[44]:
array([[ -2.21053764e-01, -2.20187426e-01, -2.38173127e-01,
-2.24671751e-01, -2.32440352e-01, -2.28797898e-01,
-2.25955158e-01, -2.28772879e-01, -2.28901237e-01,
-2.22546220e-01, -2.15402722e-01, -2.31919050e-01,
-2.24671602e-01, -2.24030137e-01, -2.37917259e-01,
-2.35338598e-01, -2.11188301e-01, -2.30172306e-01,
-2.26653352e-01, -2.27616981e-01, -2.25351438e-01,
-2.26480648e-01, -2.29957879e-01, -2.28425398e-01,

为什么同一实施之间存在很大差异?

x_reconstruction_1 = sess.run(t.x_r, feed_dict={t.z_r: z_batch[:2]})
x_reconstruction_1
Out[50]:
array([[-1., -1., -1., ..., -1., -1., -1.],
[-1., -1., -1., ..., -1., -1., -1.]], dtype=float32)
x_reconstruction_1.shape
Out[51]:
(2, 784)

结果又好了???

如果我只是多次复制一个测试样本,结果也没有。

x_reconstruction_1 = sess.run(t.x_r, feed_dict={t.z_r: np.tile(z_batch[0],(100,1))})
x_reconstruction_1
Out[61]:
array([[-0.22105289, -0.22018659, -0.23817246, ..., -0.23409246,
-0.22799131, -0.23101638],
[-0.22105289, -0.22018659, -0.23817246, ..., -0.23409246,
-0.22799131, -0.23101638],
[-0.22105289, -0.22018659, -0.23817246, ..., -0.23409246,
-0.22799131, -0.23101638],
...,
[-0.22105289, -0.22018659, -0.23817246, ..., -0.23409246,
-0.22799131, -0.23101638],
[-0.22105289, -0.22018659, -0.23817246, ..., -0.23409246,
-0.22799131, -0.23101638],
[-0.22105289, -0.22018659, -0.23817246, ..., -0.23409246,
-0.22799131, -0.23101638]], dtype=float32)

0 个答案:

没有答案