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: 4

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: c63d4351c7752a769cdc9a1bfcf79ffd140e0e6a
Time: 2020-10-29
Author: wtsang@us.ibm.com
File Name: onnx_tf/handlers/backend/unpool_mixin.py
Class Name: UnpoolMixin
Method Name: _unpool


Project Name: onnx/onnx-tensorflow
Commit Name: a39084b995d9d6d88300632c54895488985e5cfd
Time: 2017-10-24
Author: gbercea@gheorghodorsmbp.watson.ibm.com
File Name: onnx_tf/backend.py
Class Name: TensorflowBackend
Method Name: handle_flatten