Skip to content

activations = activation_model.predict(img_arr) giving error #2

@KVK012

Description

@KVK012

Hello,

I am new to TF and I am using TF version 1.13.1

I am using jupyter notebook and I got stuck at following line.
activations = activation_model.predict(img_arr)

When I execute it then it is giving an error as shown below.
`InvalidArgumentError Traceback (most recent call last)
in
----> 1 activations = activation_model.predict(img_arr)

c:\users\rameshmdamor777.conda\envs\pythongpu\lib\site-packages\keras\engine\training.py in predict(self, x, batch_size, verbose, steps)
1167 batch_size=batch_size,
1168 verbose=verbose,
-> 1169 steps=steps)
1170
1171 def train_on_batch(self, x, y,

c:\users\rameshmdamor777.conda\envs\pythongpu\lib\site-packages\keras\engine\training_arrays.py in predict_loop(model, f, ins, batch_size, verbose, steps)
292 ins_batch[i] = ins_batch[i].toarray()
293
--> 294 batch_outs = f(ins_batch)
295 batch_outs = to_list(batch_outs)
296 if batch_index == 0:

c:\users\rameshmdamor777.conda\envs\pythongpu\lib\site-packages\keras\backend\tensorflow_backend.py in call(self, inputs)
2713 return self._legacy_call(inputs)
2714
-> 2715 return self._call(inputs)
2716 else:
2717 if py_any(is_tensor(x) for x in inputs):

c:\users\rameshmdamor777.conda\envs\pythongpu\lib\site-packages\keras\backend\tensorflow_backend.py in _call(self, inputs)
2669 feed_symbols,
2670 symbol_vals,
-> 2671 session)
2672 if self.run_metadata:
2673 fetched = self._callable_fn(*array_vals, run_metadata=self.run_metadata)

c:\users\rameshmdamor777.conda\envs\pythongpu\lib\site-packages\keras\backend\tensorflow_backend.py in _make_callable(self, feed_arrays, feed_symbols, symbol_vals, session)
2621 callable_opts.run_options.CopyFrom(self.run_options)
2622 # Create callable.
-> 2623 callable_fn = session._make_callable_from_options(callable_opts)
2624 # Cache parameters corresponding to the generated callable, so that
2625 # we can detect future mismatches and refresh the callable.

c:\users\rameshmdamor777.conda\envs\pythongpu\lib\site-packages\tensorflow\python\client\session.py in _make_callable_from_options(self, callable_options)
1469 """
1470 self._extend_graph()
-> 1471 return BaseSession._Callable(self, callable_options)
1472
1473

c:\users\rameshmdamor777.conda\envs\pythongpu\lib\site-packages\tensorflow\python\client\session.py in init(self, session, callable_options)
1423 with errors.raise_exception_on_not_ok_status() as status:
1424 self._handle = tf_session.TF_SessionMakeCallable(
-> 1425 session._session, options_ptr, status)
1426 finally:
1427 tf_session.TF_DeleteBuffer(options_ptr)

c:\users\rameshmdamor777.conda\envs\pythongpu\lib\site-packages\tensorflow\python\framework\errors_impl.py in exit(self, type_arg, value_arg, traceback_arg)
526 None, None,
527 compat.as_text(c_api.TF_Message(self.status.status)),
--> 528 c_api.TF_GetCode(self.status.status))
529 # Delete the underlying status object from memory otherwise it stays alive
530 # as there is a reference to status from this from the traceback due to

InvalidArgumentError: input_3:0 is both fed and fetched.
`

Can you please help me on this.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions