4f6a511c1ad82e5f40208bb9696001cca0464777,tensorflow_transform/analyzer_nodes.py,JsonNumpyCacheCoder,encode_cache,#JsonNumpyCacheCoder#Any#,200
Before Change
def encode_cache(self, accumulator):
// Need to wrap in np.array and call tolist to make it JSON serializable.
return tf.compat.as_bytes(json.dumps(np.array(accumulator).tolist() ))
def decode_cache(self, encoded_accumulator):
return np.array(json.loads(tf.compat.as_text(encoded_accumulator)))
After Change
return x
def encode_cache(self, accumulator):
if isinstance(accumulator, (list, tuple)):
primitive_accumulator = [
self._convert_numpy_dtype(a) for a in accumulator
]
else:
primitive_accumulator = self._convert_numpy_dtype(accumulator)
// Need to wrap in np.array and call tolist to make it JSON serializable.
return tf.compat.as_bytes(json.dumps(primitive_accumulator))
def decode_cache(self, encoded_accumulator):
return np.array(json.loads(tf.compat.as_text(encoded_accumulator)))
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 7
Instances Project Name: tensorflow/transform
Commit Name: 4f6a511c1ad82e5f40208bb9696001cca0464777
Time: 2019-09-05
Author: zoy@google.com
File Name: tensorflow_transform/analyzer_nodes.py
Class Name: JsonNumpyCacheCoder
Method Name: encode_cache
Project Name: rusty1s/pytorch_geometric
Commit Name: 675b7884c09875486fdddffa2d8a6a12247ab4d7
Time: 2020-05-31
Author: matthias.fey@tu-dortmund.de
File Name: torch_geometric/utils/convert.py
Class Name:
Method Name: to_networkx
Project Name: rusty1s/pytorch_geometric
Commit Name: a998e7a1fa996edb4bcc1b34a0df5967ed6ec9e2
Time: 2020-05-13
Author: matthias.fey@tu-dortmund.de
File Name: torch_geometric/utils/convert.py
Class Name:
Method Name: to_networkx