Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor 'input_1' with dtype float [[Node: input_1 = Placeholder[dtype=DT_FLOAT, shape=<unknown>, _device="/job:localhost/replica:0/task:0/cpu:0"]( #1

Closed
johndpope opened this issue Oct 30, 2017 · 2 comments

Comments

@johndpope
Copy link

johndpope commented Oct 30, 2017

I have successfully ran the trainer. / when I go to backtest - it fails.
Actually on closer inspection - I can see a bug. saving doesn't recognize tensor shape.
Tensor("output:0", shape=(?, 1), dtype=float32)

which version of tensorflow are you using?

python driver.py -t feedforward

2017-10-30 15:01:45.434854: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations. 2017-10-30 15:01:45.435181: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. 2017-10-30 15:01:45.435203: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations. 2017-10-30 15:01:45.435214: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations. Lag 0 epoch 0 loss: 59128972527.1 Lag 0 epoch 1 loss: 46587011848.4 Lag 0 epoch 2 loss: 26121063660.8 Lag 0 epoch 3 loss: 29749124009.9 Lag 0 epoch 4 loss: 14901238999.3 The best lag is: 0 Epoch 0 completed out of 5 loss: 418341134612.0 Epoch 1 completed out of 5 loss: 49366656580.6 Epoch 2 completed out of 5 loss: 25395777597.4 Epoch 3 completed out of 5 loss: 17968284636.1 Epoch 4 completed out of 5 loss: 24333348789.0 Accuracy: 0.009250693802035153 Model saved in file: data/model/feedforward.ckpt Tensor("output:0", **shape=(?,** 1), dtype=float32)

python driver.py -b feedforward
Value before transactions: 100000
Loading pre-trained model...
2017-10-30 15:15:29.298250: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-10-30 15:15:29.298280: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-10-30 15:15:29.298295: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2017-10-30 15:15:29.298299: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
Model loaded...
Traceback (most recent call last):
  File "/Users/jpope/miniconda2/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1327, in _do_call
    return fn(*args)
  File "/Users/jpope/miniconda2/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1306, in _run_fn
    status, run_metadata)
  File "/Users/jpope/miniconda2/envs/tensorflow/lib/python3.5/contextlib.py", line 66, in __exit__
    next(self.gen)
  File "/Users/jpope/miniconda2/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/framework/errors_impl.py", line 466, in raise_exception_on_not_ok_status
    pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: You must feed a value for placeholder tensor 'input_1' with dtype float
	 [[Node: input_1 = Placeholder[dtype=DT_FLOAT, shape=<unknown>, _device="/job:localhost/replica:0/task:0/cpu:0"]()]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "driver.py", line 8, in <module>
    main()
  File "driver.py", line 5, in main
    inputHandler(inputs)
  File "/Users/jpope/Documents/cryptoWorkspace/Quant_stock/misc/arg_handler.py", line 31, in __init__
    self.run(FeedforwardStrategy)
  File "/Users/jpope/Documents/cryptoWorkspace/Quant_stock/misc/arg_handler.py", line 35, in run
    backtest_obj.run(plot=False)
  File "/Users/jpope/Documents/cryptoWorkspace/Quant_stock/pipeline/backtest.py", line 110, in run
    self.cerebro.run()
  File "/Users/jpope/miniconda2/envs/tensorflow/lib/python3.5/site-packages/backtrader/cerebro.py", line 1127, in run
    runstrat = self.runstrategies(iterstrat)
  File "/Users/jpope/miniconda2/envs/tensorflow/lib/python3.5/site-packages/backtrader/cerebro.py", line 1214, in runstrategies
    strat = stratcls(*sargs, **skwargs)
  File "/Users/jpope/miniconda2/envs/tensorflow/lib/python3.5/site-packages/backtrader/metabase.py", line 88, in __call__
    _obj, args, kwargs = cls.doinit(_obj, *args, **kwargs)
  File "/Users/jpope/miniconda2/envs/tensorflow/lib/python3.5/site-packages/backtrader/metabase.py", line 78, in doinit
    _obj.__init__(*args, **kwargs)
  File "/Users/jpope/Documents/cryptoWorkspace/Quant_stock/pipeline/strategies/ff_strat.py", line 30, in __init__
    print(self.sess.run(prediction, feed_dict={x: [[10.0]]}))
  File "/Users/jpope/miniconda2/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 895, in run
    run_metadata_ptr)
  File "/Users/jpope/miniconda2/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1124, in _run
    feed_dict_tensor, options, run_metadata)
  File "/Users/jpope/miniconda2/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1321, in _do_run
    options, run_metadata)
  File "/Users/jpope/miniconda2/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1340, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: You must feed a value for placeholder tensor 'input_1' with dtype float
	 [[Node: input_1 = Placeholder[dtype=DT_FLOAT, shape=<unknown>, _device="/job:localhost/replica:0/task:0/cpu:0"]()]]

Caused by op 'input_1', defined at:
  File "driver.py", line 8, in <module>
    main()
  File "driver.py", line 5, in main
    inputHandler(inputs)
  File "/Users/jpope/Documents/cryptoWorkspace/Quant_stock/misc/arg_handler.py", line 31, in __init__
    self.run(FeedforwardStrategy)
  File "/Users/jpope/Documents/cryptoWorkspace/Quant_stock/misc/arg_handler.py", line 35, in run
    backtest_obj.run(plot=False)
  File "/Users/jpope/Documents/cryptoWorkspace/Quant_stock/pipeline/backtest.py", line 110, in run
    self.cerebro.run()
  File "/Users/jpope/miniconda2/envs/tensorflow/lib/python3.5/site-packages/backtrader/cerebro.py", line 1127, in run
    runstrat = self.runstrategies(iterstrat)
  File "/Users/jpope/miniconda2/envs/tensorflow/lib/python3.5/site-packages/backtrader/cerebro.py", line 1214, in runstrategies
    strat = stratcls(*sargs, **skwargs)
  File "/Users/jpope/miniconda2/envs/tensorflow/lib/python3.5/site-packages/backtrader/metabase.py", line 88, in __call__
    _obj, args, kwargs = cls.doinit(_obj, *args, **kwargs)
  File "/Users/jpope/miniconda2/envs/tensorflow/lib/python3.5/site-packages/backtrader/metabase.py", line 78, in doinit
    _obj.__init__(*args, **kwargs)
  File "/Users/jpope/Documents/cryptoWorkspace/Quant_stock/pipeline/strategies/ff_strat.py", line 23, in __init__
    self.saver = tf.train.import_meta_graph("data/model/feedforward.ckpt.meta")
  File "/Users/jpope/miniconda2/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 1698, in import_meta_graph
    **kwargs)
  File "/Users/jpope/miniconda2/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/framework/meta_graph.py", line 656, in import_scoped_meta_graph
    producer_op_list=producer_op_list)
  File "/Users/jpope/miniconda2/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/framework/importer.py", line 313, in import_graph_def
    op_def=op_def)
  File "/Users/jpope/miniconda2/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 2630, in create_op
    original_op=self._default_original_op, op_def=op_def)
  File "/Users/jpope/miniconda2/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1204, 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 'input_1' with dtype float
	 [[Node: input_1 = Placeholder[dtype=DT_FLOAT, shape=<unknown>, _device="/job:localhost/replica:0/task:0/cpu:0"](
@johndpope
Copy link
Author

think my tensorflow is out of date.

@ltnguyen14
Copy link
Owner

hey @johndpope sorry for a late reply. There were some small issue with the earlier version of the software, but I've just pushed a big update, so it should work correctly now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants