Skip to content

Instantly share code, notes, and snippets.

@EntilZha
Created April 24, 2017 18:46
Show Gist options
  • Select an option

  • Save EntilZha/06a8bbd2279d01a61a1c7a5e61d882b4 to your computer and use it in GitHub Desktop.

Select an option

Save EntilZha/06a8bbd2279d01a61a1c7a5e61d882b4 to your computer and use it in GitHub Desktop.

Revisions

  1. EntilZha created this gist Apr 24, 2017.
    141 changes: 141 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,141 @@
    In [9]: model.predict(np.random.random((10, 3, 2)))
    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.
    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.
    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.
    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.
    ---------------------------------------------------------------------------
    InvalidArgumentError Traceback (most recent call last)
    /home/pedro/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args)
    1021 try:
    -> 1022 return fn(*args)
    1023 except errors.OpError as e:

    /home/pedro/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py in _run_fn(session, feed_dict, fetch_list, target_list, options, run_metadata)
    1003 feed_dict, fetch_list, target_list,
    -> 1004 status, run_metadata)
    1005

    /home/pedro/anaconda3/lib/python3.6/contextlib.py in __exit__(self, type, value, traceback)
    88 try:
    ---> 89 next(self.gen)
    90 except StopIteration:

    /home/pedro/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/errors_impl.py in raise_exception_on_not_ok_status()
    468 compat.as_text(pywrap_tensorflow.TF_Message(status)),
    --> 469 pywrap_tensorflow.TF_GetCode(status))
    470 finally:

    InvalidArgumentError: You must feed a value for placeholder tensor 'time_distributed_1/keras_learning_phase' with dtype bool
    [[Node: time_distributed_1/keras_learning_phase = Placeholder[dtype=DT_BOOL, shape=[], _device="/job:localhost/replica:0/task:0/cpu:0"]()]]

    During handling of the above exception, another exception occurred:

    InvalidArgumentError Traceback (most recent call last)
    <ipython-input-9-4104792c4c07> in <module>()
    ----> 1 model.predict(np.random.random((10, 3, 2)))

    /home/pedro/software/keras/keras/models.py in predict(self, x, batch_size, verbose)
    897 if self.model is None:
    898 self.build()
    --> 899 return self.model.predict(x, batch_size=batch_size, verbose=verbose)
    900
    901 def predict_on_batch(self, x):

    /home/pedro/software/keras/keras/engine/training.py in predict(self, x, batch_size, verbose)
    1578 f = self.predict_function
    1579 return self._predict_loop(f, ins,
    -> 1580 batch_size=batch_size, verbose=verbose)
    1581
    1582 def train_on_batch(self, x, y,

    /home/pedro/software/keras/keras/engine/training.py in _predict_loop(self, f, ins, batch_size, verbose)
    1205 ins_batch = _slice_arrays(ins, batch_ids)
    1206
    -> 1207 batch_outs = f(ins_batch)
    1208 if not isinstance(batch_outs, list):
    1209 batch_outs = [batch_outs]

    /home/pedro/software/keras/keras/backend/tensorflow_backend.py in __call__(self, inputs)
    2151 session = get_session()
    2152 updated = session.run(self.outputs + [self.updates_op],
    -> 2153 feed_dict=feed_dict)
    2154 return updated[:len(self.outputs)]
    2155

    /home/pedro/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py in run(self, fetches, feed_dict, options, run_metadata)
    765 try:
    766 result = self._run(None, fetches, feed_dict, options_ptr,
    --> 767 run_metadata_ptr)
    768 if run_metadata:
    769 proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)

    /home/pedro/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py in _run(self, handle, fetches, feed_dict, options, run_metadata)
    963 if final_fetches or final_targets:
    964 results = self._do_run(handle, final_targets, final_fetches,
    --> 965 feed_dict_string, options, run_metadata)
    966 else:
    967 results = []

    /home/pedro/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py in _do_run(self, handle, target_list, fetch_list, feed_dict, options, run_metadata)
    1013 if handle is None:
    1014 return self._do_call(_run_fn, self._session, feed_dict, fetch_list,
    -> 1015 target_list, options, run_metadata)
    1016 else:
    1017 return self._do_call(_prun_fn, self._session, handle, feed_dict,

    /home/pedro/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args)
    1033 except KeyError:
    1034 pass
    -> 1035 raise type(e)(node_def, op, message)
    1036
    1037 def _extend_graph(self):

    InvalidArgumentError: You must feed a value for placeholder tensor 'time_distributed_1/keras_learning_phase' with dtype bool
    [[Node: time_distributed_1/keras_learning_phase = Placeholder[dtype=DT_BOOL, shape=[], _device="/job:localhost/replica:0/task:0/cpu:0"]()]]

    Caused by op 'time_distributed_1/keras_learning_phase', defined at:
    File "/home/pedro/anaconda3/bin/ipython", line 6, in <module>
    sys.exit(IPython.start_ipython())
    File "/home/pedro/anaconda3/lib/python3.6/site-packages/IPython/__init__.py", line 119, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
    File "/home/pedro/anaconda3/lib/python3.6/site-packages/traitlets/config/application.py", line 658, in launch_instance
    app.start()
    File "/home/pedro/anaconda3/lib/python3.6/site-packages/IPython/terminal/ipapp.py", line 348, in start
    self.shell.mainloop()
    File "/home/pedro/anaconda3/lib/python3.6/site-packages/IPython/terminal/interactiveshell.py", line 440, in mainloop
    self.interact()
    File "/home/pedro/anaconda3/lib/python3.6/site-packages/IPython/terminal/interactiveshell.py", line 431, in interact
    self.run_cell(code, store_history=True)
    File "/home/pedro/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2717, in run_cell
    interactivity=interactivity, compiler=compiler, result=result)
    File "/home/pedro/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2827, in run_ast_nodes
    if self.run_code(code, result):
    File "/home/pedro/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2881, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
    File "<ipython-input-7-7feb8d6104c1>", line 1, in <module>
    model.add(wrappers.TimeDistributed(core.Dropout(.5), input_shape=(3, 2)))
    File "/home/pedro/software/keras/keras/models.py", line 430, in add
    layer(x)
    File "/home/pedro/software/keras/keras/engine/topology.py", line 585, in __call__
    output = self.call(inputs, **kwargs)
    File "/home/pedro/software/keras/keras/layers/wrappers.py", line 177, in call
    y = self.layer.call(inputs) # (num_samples * timesteps, ...)
    File "/home/pedro/software/keras/keras/layers/core.py", line 111, in call
    training=training)
    File "/home/pedro/software/keras/keras/backend/tensorflow_backend.py", line 2483, in in_train_phase
    training = learning_phase()
    File "/home/pedro/software/keras/keras/backend/tensorflow_backend.py", line 103, in learning_phase
    name='keras_learning_phase')
    File "/home/pedro/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 1520, in placeholder
    name=name)
    File "/home/pedro/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 2149, in _placeholder
    name=name)
    File "/home/pedro/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 763, in apply_op
    op_def=op_def)
    File "/home/pedro/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 2395, in create_op
    original_op=self._default_original_op, op_def=op_def)
    File "/home/pedro/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1264, in __init__
    self._traceback = _extract_stack()

    InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor 'time_distributed_1/keras_learning_phase' with dtype bool
    [[Node: time_distributed_1/keras_learning_phase = Placeholder[dtype=DT_BOOL, shape=[], _device="/job:localhost/replica:0/task:0/cpu:0"]()]]