In jupyter note book, when I ran / src / model.py,
The following error occurred.
TypeError Traceback (most recent call last)
in ()
18 valid_batch = batch.astype (np.float32)
19
---> 20 v_l, yT = sess.run ([loss, yT], feed_dict = {x: valid_batch}
21 yT = yT [:, 0]
22 print ('Validation predictions:% s'% yT)
/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.pyc in run (self, fetches, feed_dict, options, run_metadata)
764 try:
765 result = self._run (None, fetches, feed_dict, options_ptr,
-> 766 run_metadata_ptr)
767 if run_metadata:
768 proto_data = tf_session.TF_GetBuffer (run_metadata_ptr)
/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.pyc in _run (self, handle, fetches, feed_dict, options, run_metadata)
949
950 # Create a fetch handler to take care of the structure of fetches.
-> 951 fetch_handler = _FetchHandler (self._graph, fetches, feed_dict_string)
952
953 # Run request and get response.
/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.pyc in __init __ (self, graph, fetches, feeds)
405 "" "
406 with graph.as_default ():
-> 407 self._fetch_mapper = _FetchMapper.for_fetch (fetches)
408 self._fetches = []
409 self._targets = []
/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.pyc 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)
/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.pyc 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
/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.pyc in for_fetch (fetch)
236 if isinstance (fetch, tensor_type):
237 fetches, contraction_fn = fetch_fn (fetch)
-> 238 return _ElementFetchMapper (fetches, contraction_fn)
239 # Did not find anything.
240 raise TypeError ('Fetch argument% r has invalid type% r'
/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.pyc in __init __ (self, fetches, contraction_fn)
269 raise TypeError ('Fetch argument% r has invalid type% r,
270 'must be a string or Tensor. (% S) '
-> 271% (fetch, type (fetch), str (e)))
272 except ValueError as e:
273 raise ValueError ('Fetch argument% r can not be interpreted as a'
TypeError: Fetch argument array ([0.00020096, 0.00783397, 0.0033433, 0.01605761, 0.01444326], dtype = float32) has invalid type <type 'numpy.ndarray', must be a string or Tensor. (Can not convert a ndarray into a Tensor or Operation.)
How do I resolve it?
Currently I am using python 2.7,
I'm using tensorflow 0.12.