卷积层的输出如何查看?


(ljj13802239795) #1

“lstm+cnn深度学习预测股价”策略中的模块m14是个 Conv2D层 (v1)卷积层模块。

用data.read()查看其输出报错如下:

m14.data.read()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-86-5c212c45e1ae> in <module>()
----> 1 m14.data.read()

AttributeError: 'Tensor' object has no attribute 'read'


用tf.Session.run()查看其输出报错如下:
sess=tf.Session()
sess.run(m14.data)
---------------------------------------------------------------------------
InvalidArgumentError                      Traceback (most recent call last)
InvalidArgumentError: You must feed a value for placeholder tensor 'BIGQUANT_TEMP_NAME_d470e9c6ebe211e983fd0a580a8102fc__' with dtype float and shape [?,50,5]
	 [[Node: BIGQUANT_TEMP_NAME_d470e9c6ebe211e983fd0a580a8102fc__ = Placeholder[dtype=DT_FLOAT, shape=[?,50,5], _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]

During handling of the above exception, another exception occurred:

InvalidArgumentError                      Traceback (most recent call last)
<ipython-input-88-7f7240abeb38> in <module>()
      1 sess=tf.Session()
----> 2 sess.run(m14.data)

InvalidArgumentError: You must feed a value for placeholder tensor 'BIGQUANT_TEMP_NAME_d470e9c6ebe211e983fd0a580a8102fc__' with dtype float and shape [?,50,5]
	 [[Node: BIGQUANT_TEMP_NAME_d470e9c6ebe211e983fd0a580a8102fc__ = Placeholder[dtype=DT_FLOAT, shape=[?,50,5], _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]

Caused by op 'BIGQUANT_TEMP_NAME_d470e9c6ebe211e983fd0a580a8102fc__', defined at:
  File "/usr/local/python3/lib/python3.5/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/python3/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/var/app/enabled/jupyterlab_launcher/bigrun_bigkernel.py", line 4, in <module>
    main()
  File "/usr/local/python3/lib/python3.5/site-packages/traitlets/config/application.py", line 664, in launch_instance
    app.start()
  File "/usr/local/python3/lib/python3.5/site-packages/ipykernel/kernelapp.py", line 563, in start
    self.io_loop.start()
  File "/usr/local/python3/lib/python3.5/site-packages/tornado/ioloop.py", line 832, in start
    self._run_callback(self._callbacks.popleft())
  File "/usr/local/python3/lib/python3.5/site-packages/tornado/ioloop.py", line 605, in _run_callback
    ret = callback()
  File "/usr/local/python3/lib/python3.5/site-packages/tornado/stack_context.py", line 277, in null_wrapper
    return fn(*args, **kwargs)
  File "/usr/local/python3/lib/python3.5/site-packages/tornado/gen.py", line 1152, in inner
    self.run()
  File "/usr/local/python3/lib/python3.5/site-packages/tornado/gen.py", line 1069, in run
    yielded = self.gen.send(value)
  File "/usr/local/python3/lib/python3.5/site-packages/ipykernel/kernelbase.py", line 365, in process_one
    yield gen.maybe_future(dispatch(*args))
  File "/usr/local/python3/lib/python3.5/site-packages/tornado/gen.py", line 307, in wrapper
    yielded = next(result)
  File "/usr/local/python3/lib/python3.5/site-packages/ipykernel/kernelbase.py", line 272, in dispatch_shell
    yield gen.maybe_future(handler(stream, idents, msg))
  File "/usr/local/python3/lib/python3.5/site-packages/tornado/gen.py", line 307, in wrapper
    yielded = next(result)
  File "/usr/local/python3/lib/python3.5/site-packages/ipykernel/kernelbase.py", line 542, in execute_request
    user_expressions, allow_stdin,
  File "/usr/local/python3/lib/python3.5/site-packages/tornado/gen.py", line 307, in wrapper
    yielded = next(result)
  File "/usr/local/python3/lib/python3.5/site-packages/ipykernel/ipkernel.py", line 294, in do_execute
    res = shell.run_cell(code, store_history=store_history, silent=silent)
  File "/usr/local/python3/lib/python3.5/site-packages/ipykernel/zmqshell.py", line 536, in run_cell
    return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
  File "/usr/local/python3/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 2728, in run_cell
    interactivity=interactivity, compiler=compiler, result=result)
  File "/usr/local/python3/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 2850, in run_ast_nodes
    if self.run_code(code, result):
  File "/usr/local/python3/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 2910, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-35-e186a1ab8c5b>", line 10, in <module>
    name=''
  File "/usr/local/python3/lib/python3.5/site-packages/keras/engine/topology.py", line 1457, in Input
    input_tensor=tensor)
  File "/usr/local/python3/lib/python3.5/site-packages/keras/legacy/interfaces.py", line 91, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/python3/lib/python3.5/site-packages/keras/engine/topology.py", line 1366, in __init__
    name=self.name)
  File "/usr/local/python3/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 508, in placeholder
    x = tf.placeholder(dtype, shape=shape, name=name)
  File "/usr/local/python3/lib/python3.5/site-packages/tensorflow/python/ops/array_ops.py", line 1808, in placeholder
    return gen_array_ops.placeholder(dtype=dtype, shape=shape, name=name)
  File "/usr/local/python3/lib/python3.5/site-packages/tensorflow/python/ops/gen_array_ops.py", line 4848, in placeholder
    "Placeholder", dtype=dtype, shape=shape, name=name)
  File "/usr/local/python3/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
  File "/usr/local/python3/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 3392, in create_op
    op_def=op_def)
  File "/usr/local/python3/lib/python3.5/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): You must feed a value for placeholder tensor 'BIGQUANT_TEMP_NAME_d470e9c6ebe211e983fd0a580a8102fc__' with dtype float and shape [?,50,5]
	 [[Node: BIGQUANT_TEMP_NAME_d470e9c6ebe211e983fd0a580a8102fc__ = Placeholder[dtype=DT_FLOAT, shape=[?,50,5], _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]

(达达) #2

可以参考社区文章


(ljj13802239795) #3

明白了,非常感谢!