question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fetch argument None has invalid type <class 'NoneType'>

See original GitHub issue

Hi. I’m having a lot of trouble trying to get your function to work. I’m getting an error now that looks like it is coming from your deconvolution functions. Could you please let me know what you think the solution is?

Code I used:

is_loaded=tf_cnnvis.deconv_visualization(graph_or_path=tf.get_default_graph(),
                                         value_feed_dict={x_pl:x_batch, y_gt:targets_batch, is_training:False, valid_eval_accs:1000.0, valid_xent:1000.0},
                                         layers='r',
                                         path_logdir="c:/p17/logs/tf_cnnvis/flowers/1/logs",
                                         path_outdir="c:/p17/logs/tf_cnnvis/flowers/1/out")

Thanks.

INFO:tensorflow:Restoring parameters from model\tmp-model
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-13-41761d870143> in <module>()
      3                                          layers='r',
      4                                          path_logdir="c:/p17/logs/tf_cnnvis/flowers/1/logs",
----> 5                                          path_outdir="c:/p17/logs/tf_cnnvis/flowers/1/out")

C:\Users\username\Anaconda3\envs\tfGPU\lib\site-packages\tf_cnnvis-1.0.0-py3.5.egg\tf_cnnvis\tf_cnnvis.py in deconv_visualization(graph_or_path, value_feed_dict, input_tensor, layers, path_logdir, path_outdir)
    381 def deconv_visualization(graph_or_path, value_feed_dict, input_tensor = None, layers = 'r', path_logdir = './Log', path_outdir = "./Output"):
    382 	is_success = _get_visualization(graph_or_path, value_feed_dict, input_tensor = input_tensor, layers = layers, method = "deconv", 
--> 383 		path_logdir = path_logdir, path_outdir = path_outdir)
    384         return is_success
    385 def deepdream_visualization(graph_or_path, value_feed_dict, layer, classes, input_tensor = None, path_logdir = './Log', path_outdir = "./Output"):

C:\Users\username\Anaconda3\envs\tfGPU\lib\site-packages\tf_cnnvis-1.0.0-py3.5.egg\tf_cnnvis\tf_cnnvis.py in _get_visualization(graph_or_path, value_feed_dict, input_tensor, layers, path_logdir, path_outdir, method)
    149                         elif layers != None and layers.lower() in dict_layer.keys():
    150                                 layer_type = dict_layer[layers.lower()]
--> 151                                 is_success = _visualization_by_layer_type(g, value_feed_dict, input_tensor, layer_type, method, path_logdir, path_outdir)
    152                         else:
    153                                 is_success = False

C:\Users\username\Anaconda3\envs\tfGPU\lib\site-packages\tf_cnnvis-1.0.0-py3.5.egg\tf_cnnvis\tf_cnnvis.py in _visualization_by_layer_type(graph, value_feed_dict, input_tensor, layer_type, method, path_logdir, path_outdir)
    202 
    203         for layer in layers:
--> 204                 is_success = _visualization_by_layer_name(graph, value_feed_dict, input_tensor, layer, method, path_logdir, path_outdir)
    205         return is_success
    206 

C:\Users\username\Anaconda3\envs\tfGPU\lib\site-packages\tf_cnnvis-1.0.0-py3.5.egg\tf_cnnvis\tf_cnnvis.py in _visualization_by_layer_name(graph, value_feed_dict, input_tensor, layer_name, method, path_logdir, path_outdir)
    263                         elif method == "deconv":
    264                                 # deconvolution
--> 265                                 results = _deconvolution(graph, sess, op_tensor, X, feed_dict)
    266                         elif method == "deepdream":
    267                                 # deepdream

C:\Users\username\Anaconda3\envs\tfGPU\lib\site-packages\tf_cnnvis-1.0.0-py3.5.egg\tf_cnnvis\tf_cnnvis.py in _deconvolution(graph, sess, op_tensor, X, feed_dict)
    310                                                 c += 1
    311                                 if c > 0:
--> 312                                         out.extend(sess.run(reconstruct[:c], feed_dict = feed_dict))
    313         return out
    314 def _deepdream(graph, sess, op_tensor, X, feed_dict, layer, path_outdir, path_logdir):

C:\Users\username\Anaconda3\envs\tfGPU\lib\site-packages\tensorflow\python\client\session.py in run(self, fetches, feed_dict, options, run_metadata)
    787     try:
    788       result = self._run(None, fetches, feed_dict, options_ptr,
--> 789                          run_metadata_ptr)
    790       if run_metadata:
    791         proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)

C:\Users\username\Anaconda3\envs\tfGPU\lib\site-packages\tensorflow\python\client\session.py in _run(self, handle, fetches, feed_dict, options, run_metadata)
    982     # Create a fetch handler to take care of the structure of fetches.
    983     fetch_handler = _FetchHandler(
--> 984         self._graph, fetches, feed_dict_string, feed_handles=feed_handles)
    985 
    986     # Run request and get response.

C:\Users\username\Anaconda3\envs\tfGPU\lib\site-packages\tensorflow\python\client\session.py in __init__(self, graph, fetches, feeds, feed_handles)
    408     """
    409     with graph.as_default():
--> 410       self._fetch_mapper = _FetchMapper.for_fetch(fetches)
    411     self._fetches = []
    412     self._targets = []

C:\Users\username\Anaconda3\envs\tfGPU\lib\site-packages\tensorflow\python\client\session.py in for_fetch(fetch)
    228     elif isinstance(fetch, (list, tuple)):
    229       # NOTE(touts): This is also the code path for namedtuples.
--> 230       return _ListFetchMapper(fetch)
    231     elif isinstance(fetch, dict):
    232       return _DictFetchMapper(fetch)

C:\Users\username\Anaconda3\envs\tfGPU\lib\site-packages\tensorflow\python\client\session.py in __init__(self, fetches)
    335     """
    336     self._fetch_type = type(fetches)
--> 337     self._mappers = [_FetchMapper.for_fetch(fetch) for fetch in fetches]
    338     self._unique_fetches, self._value_indices = _uniquify_fetches(self._mappers)
    339 

C:\Users\username\Anaconda3\envs\tfGPU\lib\site-packages\tensorflow\python\client\session.py in <listcomp>(.0)
    335     """
    336     self._fetch_type = type(fetches)
--> 337     self._mappers = [_FetchMapper.for_fetch(fetch) for fetch in fetches]
    338     self._unique_fetches, self._value_indices = _uniquify_fetches(self._mappers)
    339 

C:\Users\username\Anaconda3\envs\tfGPU\lib\site-packages\tensorflow\python\client\session.py in for_fetch(fetch)
    225     if fetch is None:
    226       raise TypeError('Fetch argument %r has invalid type %r' %
--> 227                       (fetch, type(fetch)))
    228     elif isinstance(fetch, (list, tuple)):
    229       # NOTE(touts): This is also the code path for namedtuples.

TypeError: Fetch argument None has invalid type <class 'NoneType'>

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:22 (10 by maintainers)

github_iconTop GitHub Comments

4reactions
pabucurcommented, Aug 9, 2017

@falaktheoptimist I’ve tried it out. Here for the deconvolution it works!

1reaction
fqeqiq168commented, Sep 28, 2017

@BhagyeshVikani , Thank you very much , it works. because i use slim , so don’t need to feed value_feed_dict, just pass the image to input_tensor.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tensorflow TypeError: Fetch argument None has invalid type ...
You are re-assigning the train_step variable to the second element of the result of sess.run() (which happens to be None ).
Read more >
DeepExplainer - TypeError: Fetch argument None has invalid ...
keras throws the "TypeError: Fetch argument None has invalid type <type 'NoneType'>". The issue seems to occur because keras uses the GatherV2 ...
Read more >
Tensorflow TypeError: Fetch argument None has ... - Intellipaat
I'm building an RNN loosely based on the TensorFlow tutorial. The relevant parts of my model are ... this, so any help would...
Read more >
问答- 腾讯云开发者社区-腾讯云
_run(None, fetches, feed_dict, options_ptr, --> 895 run_metadata_ptr) 896 if ... TypeError: Fetch argument None has invalid type <class 'NoneType'>
Read more >
Fetch argument None has invalid type <class 'NoneType'> - 简书
问题:. TypeError: Fetch argument None has invalid type <class 'NoneType'>. 解决方法:. 可能是由于 sess.run([op]) 中的op操作不存在,即为None。 0人点赞.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found