Tensorflow:InvalidArgumentError:预期的大小[0]在[0,150]中,但得到了300

时间:2018-06-30 00:25:59

标签: python-2.7 tensorflow

我不知道这是否相关,但是超级计算机操作员昨天进行了Booster模块的升级。之后,我的tensorflow脚本在此之前运行良好,并引发以下错误:

2018-06-30 02:21:11.787262: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
Traceback (most recent call last):
  File "/homeb/eusmi01/eusmi0100/Programs/consscortk/bin/deep-ScaffOpt.py", line 524, in <module>
    serial_RF=False))
  File "/homeb/eusmi01/eusmi0100/Programs/consscortk/bin/deep-ScaffOpt.py", line 189, in train_MLP
    MLP = deepMetaPredictor().combinePredictors_datatypes(datasets, mat, serial_RF=serial_RF, META_ZCUTOFF=datasets.args.META_ZCUTOFF)
  File "/homeb/eusmi01/eusmi0100/Programs/consscortk/lib/deepMetaPredictor.py", line 169, in combinePredictors_datatypes
    mlp.fit(datasets.x_crossval['lhl'], datasets.y_crossval['lhl'])
  File "/homeb/eusmi01/eusmi0100/Programs/consscortk/lib/ANN_functions.py", line 324, in fit
    _, c, p = self.sess.run([self.optimizer, self.cost, self.pred], feed_dict={self.x: batch_x, self.y: batch_y})
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 900, in run
    run_metadata_ptr)
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1135, in _run
    feed_dict_tensor, options, run_metadata)
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1316, in _do_run
    run_metadata)
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1335, in _do_call
    raise type(e)(node_def, op, message)
InvalidArgumentError: Expected size[0] in [0, 150], but got 300
     [[Node: Slice = Slice[Index=DT_INT32, T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_Placeholder_1_0_1, Slice/begin, gradients/sub_grad/Shape_1)]]

Caused by op u'Slice', defined at:
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/scoop/_control.py", line 127, in runFuture
    future.resultValue = future.callable(*future.args, **future.kargs)
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/runpy.py", line 252, in run_path
    return _run_module_code(code, init_globals, run_name, path_name)
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/runpy.py", line 82, in _run_module_code
    mod_name, mod_fname, mod_loader, pkg_name)
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/homeb/eusmi01/eusmi0100/Programs/consscortk/bin/deep-ScaffOpt.py", line 524, in <module>
    serial_RF=False))
  File "/homeb/eusmi01/eusmi0100/Programs/consscortk/bin/deep-ScaffOpt.py", line 189, in train_MLP
    MLP = deepMetaPredictor().combinePredictors_datatypes(datasets, mat, serial_RF=serial_RF, META_ZCUTOFF=datasets.args.META_ZCUTOFF)
  File "/homeb/eusmi01/eusmi0100/Programs/consscortk/lib/deepMetaPredictor.py", line 167, in combinePredictors_datatypes
    random_state=datasets.random_state)
  File "/homeb/eusmi01/eusmi0100/Programs/consscortk/lib/ANN_functions.py", line 235, in __init__
    self.cost = tf_group_RMSE(self.y, self.pred, matrices.assaysize_vec, matrices.group_matrix) \
  File "/homeb/eusmi01/eusmi0100/Programs/consscortk/lib/ConsScoreTK_Statistics.py", line 1261, in tf_group_RMSE
    Y = tf.slice(Y, [0], [b_molnum])
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.py", line 650, in slice
    return gen_array_ops._slice(input_, begin, size, name=name)
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/tensorflow/python/ops/gen_array_ops.py", line 7093, in _slice
    "Slice", input=input, begin=begin, size=size, name=name)
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 3392, in create_op
    op_def=op_def)
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1718, in __init__
    self._traceback = self._graph._extract_stack()  # pylint: disable=protected-access

InvalidArgumentError (see above for traceback): Expected size[0] in [0, 150], but got 300
     [[Node: Slice = Slice[Index=DT_INT32, T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_Placeholder_1_0_1, Slice/begin, gradients/sub_grad/Shape_1)]]


Traceback (most recent call last):
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/scoop/bootstrap/__main__.py", line 302, in <module>
    b.main()
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/scoop/bootstrap/__main__.py", line 92, in main
    self.run()
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/scoop/bootstrap/__main__.py", line 290, in run
    futures_startup()
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/scoop/bootstrap/__main__.py", line 271, in futures_startup
    run_name="__main__"
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/scoop/futures.py", line 64, in _startup
    result = _controller.switch(rootFuture, *args, **kargs)
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/scoop/_control.py", line 253, in runController
    raise future.exceptionValue
tensorflow.python.framework.errors_impl.InvalidArgumentError: Expected size[0] in [0, 150], but got 300
     [[Node: Slice = Slice[Index=DT_INT32, T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_Placeholder_1_0_1, Slice/begin, gradients/sub_grad/Shape_1)]]

Caused by op u'Slice', defined at:
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/scoop/_control.py", line 127, in runFuture
    future.resultValue = future.callable(*future.args, **future.kargs)
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/runpy.py", line 252, in run_path
    return _run_module_code(code, init_globals, run_name, path_name)
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/runpy.py", line 82, in _run_module_code
    mod_name, mod_fname, mod_loader, pkg_name)
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/homeb/eusmi01/eusmi0100/Programs/consscortk/bin/deep-ScaffOpt.py", line 524, in <module>
    serial_RF=False))
  File "/homeb/eusmi01/eusmi0100/Programs/consscortk/bin/deep-ScaffOpt.py", line 189, in train_MLP
    MLP = deepMetaPredictor().combinePredictors_datatypes(datasets, mat, serial_RF=serial_RF, META_ZCUTOFF=datasets.args.META_ZCUTOFF)
  File "/homeb/eusmi01/eusmi0100/Programs/consscortk/lib/deepMetaPredictor.py", line 167, in combinePredictors_datatypes
    random_state=datasets.random_state)
  File "/homeb/eusmi01/eusmi0100/Programs/consscortk/lib/ANN_functions.py", line 235, in __init__
    self.cost = tf_group_RMSE(self.y, self.pred, matrices.assaysize_vec, matrices.group_matrix) \
  File "/homeb/eusmi01/eusmi0100/Programs/consscortk/lib/ConsScoreTK_Statistics.py", line 1261, in tf_group_RMSE
    Y = tf.slice(Y, [0], [b_molnum])
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.py", line 650, in slice
    return gen_array_ops._slice(input_, begin, size, name=name)
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/tensorflow/python/ops/gen_array_ops.py", line 7093, in _slice
    "Slice", input=input, begin=begin, size=size, name=name)
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 3392, in create_op
    op_def=op_def)
  File "/homeb/eusmi01/eusmi0100/Programs/Miniconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1718, in __init__
    self._traceback = self._graph._extract_stack()  # pylint: disable=protected-access

InvalidArgumentError (see above for traceback): Expected size[0] in [0, 150], but got 300
     [[Node: Slice = Slice[Index=DT_INT32, T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_Placeholder_1_0_1, Slice/begin, gradients/sub_grad/Shape_1)]]

我使用的Tensorflow版本是1.8.0。记录下来,在安装了1.4.0-dev版本的笔记本电脑上,相同的代码也可以正常工作。有人能启发我这个错误的根源吗?

0 个答案:

没有答案