e164c3574da160fb72fc962947a783fa299424e3,sonnet/src/batch_apply.py,,merge_leading_dims,#Any#Any#,97

Before Change



  if len(x.shape) < num_dims:
    return x
  return tf.reshape(x, [-1] + x.shape.as_list()[num_dims:])

After Change


    return tf.reshape(x, static_shape)

  // Shape can"t be inferred statically.
  tensor_shape = tf.shape(x)
  leading_dim = tf.reduce_prod(tensor_shape[:num_dims], keepdims=True)
  other_dims = tensor_shape[num_dims:]
  dynamic_shape = tf.concat([leading_dim, other_dims], axis=0)
  result = tf.reshape(x, dynamic_shape)
  // We lose some static shape information from the above reduce/slice/concat
  // dance, so we explicitly pass it in from what we computed earlier.
  result.set_shape(static_shape)
  return result
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: deepmind/sonnet
Commit Name: e164c3574da160fb72fc962947a783fa299424e3
Time: 2019-07-07
Author: tomhennigan@google.com
File Name: sonnet/src/batch_apply.py
Class Name:
Method Name: merge_leading_dims


Project Name: deepmind/sonnet
Commit Name: e164c3574da160fb72fc962947a783fa299424e3
Time: 2019-07-07
Author: tomhennigan@google.com
File Name: sonnet/src/batch_apply.py
Class Name:
Method Name: merge_leading_dims


Project Name: GPflow/GPflow
Commit Name: f746253f6d61780397e0aebd997f0f1b5db17ed6
Time: 2018-07-17
Author: dutordoirv@gmail.com
File Name: gpflow/quadrature.py
Class Name:
Method Name: ndiag_mc


Project Name: GPflow/GPflow
Commit Name: f01a7761d70d727ef4ea42c05464c2f85679ecd1
Time: 2018-12-27
Author: art.art.v@gmail.com
File Name: gpflow/kernels/base.py
Class Name: Kernel
Method Name: slice_cov