30146171032ed79ec99ff002ef8f7065c70d8536,tensorflow_transform/analyzers.py,,mean,#Any#Any#Any#Any#,449

Before Change


    if output_dtype is None:
      raise TypeError("Tensor type %r is not supported" % x.dtype)
  sum_dtype, sum_fn = _sum_combine_fn_and_dtype(x.dtype)
  if isinstance(x, tf.SparseTensor):
    if not reduce_instance_dims:
      raise TypeError(
          "SparseTensor is only supported when reduce_instance_dims=True")
    x = x.values
  with tf.name_scope(name, "mean"):
    // For now _numeric_combine will return a tuple with as many elements as the
    // input tuple.
    x_count, x_sum = _numeric_combine(  // pylint: disable=unbalanced-tuple-unpacking

After Change


      raise TypeError("Tensor type %r is not supported" % x.dtype)
  sum_dtype, sum_fn = _sum_combine_fn_and_dtype(x.dtype)
  with tf.name_scope(name, "mean"):
    if isinstance(x, tf.SparseTensor):
      if reduce_instance_dims:
        ones_values, x_values = tf.ones_like(x.values), x.values
      else:
        sparse_ones = tf.SparseTensor(
            indices=x.indices,
            values=tf.ones_like(x.values),
            dense_shape=x.dense_shape)
        ones_values = tf.sparse_reduce_sum(sparse_ones, axis=0, keep_dims=True)
        x = tf.cast(x, output_dtype)
        ones_values = tf.cast(ones_values, output_dtype)
        x_values = tf.sparse_reduce_sum(x, axis=0, keep_dims=True)
    else:
      ones_values, x_values = tf.ones_like(x), x
    x_count, x_sum = _numeric_combine(  // pylint: disable=unbalanced-tuple-unpacking
        [ones_values, x_values],
        sum_fn,
        reduce_instance_dims,
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: tensorflow/transform
Commit Name: 30146171032ed79ec99ff002ef8f7065c70d8536
Time: 2018-06-18
Author: tf-transform-dev@google.com
File Name: tensorflow_transform/analyzers.py
Class Name:
Method Name: mean


Project Name: RasaHQ/rasa
Commit Name: d4a2f656470e3190f8e877139455abcff1ad7cdb
Time: 2018-09-28
Author: mr.voov@gmail.com
File Name: rasa_core/policies/tf_utils.py
Class Name: TimedNTM
Method Name: __call__


Project Name: rail-berkeley/softlearning
Commit Name: cdf1e5890978ce2c487f3694dee26b9317592de2
Time: 2020-06-07
Author: kristian.hartikainen@gmail.com
File Name: softlearning/environments/adapters/dm_control_adapter.py
Class Name: DmControlAdapter
Method Name: __init__