f73cdc286a3e125cf7019336621cb10370ebfd52,tensorflow_transform/analyzer_nodes.py,_VocabularyAccumulatorCoder,encode_cache,#_VocabularyAccumulatorCoder#Any#,393

Before Change



  def encode_cache(self, accumulator):
    // Need to wrap in np.array and call tolist to make it JSON serializable.
    word, count = accumulator
    if self._input_dtype == tf.string:
      word = tf.compat.as_text(word)
    accumulator = (word, count)

After Change


    // If the value is a _WeightedMeanAndVarAccumulator, cast each field to a
    // list for serialization.
    try:
      value = value._replace(
          count=value.count.tolist(),
          mean=value.mean.tolist(),
          variance=value.variance.tolist(),
          weight=value.weight.tolist())
    except AttributeError:
      pass
    accumulator = (token, value)
    return tf.compat.as_bytes(
        json.dumps(np.array(accumulator, dtype=object).tolist()))

  def decode_cache(self, encoded_accumulator):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: tensorflow/transform
Commit Name: f73cdc286a3e125cf7019336621cb10370ebfd52
Time: 2019-04-25
Author: askerryryan@google.com
File Name: tensorflow_transform/analyzer_nodes.py
Class Name: _VocabularyAccumulatorCoder
Method Name: encode_cache


Project Name: scipy/scipy
Commit Name: e7cdf601297885874aa520598b8adebce176046a
Time: 2019-08-15
Author: chelsea.liu@datadoghq.com
File Name: scipy/optimize/_linprog.py
Class Name:
Method Name: linprog


Project Name: scipy/scipy
Commit Name: 9f92fbb72cb49ea2def0350eecaf249e8364edc8
Time: 2019-10-27
Author: chelsea.liu@datadoghq.com
File Name: scipy/optimize/_linprog.py
Class Name:
Method Name: linprog