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.
  result.set_shape(static_shape)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

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: GPflow/GPflow
Commit Name: 55d342a0d0e44f3420877a8e9452adba7933ae72
Time: 2019-04-11
Author: art.art.v@gmail.com
File Name: gpflow/conditionals/util.py
Class Name:
Method Name: base_conditional


Project Name: NVIDIA/OpenSeq2Seq
Commit Name: 3dd89618e1d07a9d2d605ddd32ccfe36b29b3af3
Time: 2018-07-11
Author: jasoli@nvidia.com
File Name: open_seq2seq/losses/tacotron_loss.py
Class Name: TacotronLoss
Method Name: _compute_loss


Project Name: uber/ludwig
Commit Name: 99754e7c704346c025a21ee61efeda2f7c02a3b3
Time: 2020-05-09
Author: jimthompson5802@gmail.com
File Name: ludwig/models/modules/sequence_decoders.py
Class Name: SequenceGeneratorDecoder
Method Name: decoder_training