I have a Tensor which I'm trying to save as a TensorProto as shown here
print(type(x))
print('TensorProto:\n{}'.format(x))
# Save the TensorProto
with open('tensor.pb', 'wb+') as f:
f.write(x.SerializeToString())
Error:
<class 'tensorflow.python.framework.ops.Tensor'>
(1, 118, 120, 80, 3)
TensorProto:
Tensor("images:0", shape=(?, ?, 120, 80, 3), dtype=float32)
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/harry/mm/Bosch_DL_HW_Benchmark/03_benchmark/03_code/evaluation/evaluate_network_actrec.py", line 218, in <module>
f.write(x.SerializeToString())
File "/home/harry/.local/lib/python3.8/site-packages/tensorflow/python/framework/ops.py", line 401, in __getattr__
self.__getattribute__(name)
AttributeError: 'Tensor' object has no attribute 'SerializeToString'
What am I doing wrong here?