MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _serialize_tensors

Function _serialize_tensors

tensorflow/python/keras/engine/network.py:1859–1876  ·  view source on GitHub ↗

Serializes Tensors passed to `call`.

(kwargs)

Source from the content-addressed store, hash-verified

1857
1858
1859def _serialize_tensors(kwargs):
1860 """Serializes Tensors passed to `call`."""
1861
1862 def _serialize_keras_tensor(t):
1863 """Serializes a single Tensor passed to `call`."""
1864 if hasattr(t, '_keras_history'):
1865 kh = t._keras_history
1866 return [kh.layer.name, kh.node_index, kh.tensor_index]
1867
1868 if isinstance(t, np.ndarray):
1869 return t.tolist()
1870
1871 if isinstance(t, ops.Tensor):
1872 return backend.get_value(t).tolist()
1873
1874 return t
1875
1876 return nest.map_structure(_serialize_keras_tensor, kwargs)
1877
1878
1879def _deserialize_keras_tensors(kwargs, layer_map):

Callers 1

get_configMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected