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



  // 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.
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: onnx/onnx-tensorflow
Commit Name: a48b4c2744126c782c9e9a207af04bbfaac74e9b
Time: 2018-02-23
Author: fumihwh@gmail.com
File Name: onnx_tf/backend.py
Class Name: TensorflowBackend
Method Name: handle_softmax


Project Name: deepmind/sonnet
Commit Name: f6a930bfc23be8cc02f8901b415ebfcf142a94e7
Time: 2018-06-01
Author: noreply@google.com
File Name: sonnet/python/modules/basic.py
Class Name: MergeDims
Method Name: _merge