fd758534e21a68dfc934cf5dff3fe4183986df51,tensorflow/python/keras/utils/version_utils.py,,swap_class,#Any#Any#Any#Any#,98

Before Change


    return v1_cls

  // Recursively search superclasses to swap in the right Keras class.
  cls.__bases__ = tuple(
      swap_class(base, v2_cls, v1_cls, use_v2) for base in cls.__bases__)
  return cls


def disallow_legacy_graph(cls_name, method_name):

After Change


    return v2_cls if use_v2 else v1_cls

  // Recursively search superclasses to swap in the right Keras class.
  new_bases = []
  for base in cls.__bases__:
    if ((use_v2 and issubclass(base, v1_cls)
         // `v1_cls` often extends `v2_cls`, so it may still call `swap_class`
         // even if it doesn"t need to. That being said, it may be the safest
         // not to over optimize this logic for the sake of correctness,
         // especially if we swap v1 & v2 classes that don"t extend each other,
         // or when the inheritance order is different.
         or (not use_v2 and issubclass(base, v2_cls)))):
      new_base = swap_class(base, v2_cls, v1_cls, use_v2)
    else:
      new_base = base
    new_bases.append(new_base)
  cls.__bases__ = tuple(new_bases)
  return cls


def disallow_legacy_graph(cls_name, method_name):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 12

Instances


Project Name: tensorflow/tensorflow
Commit Name: fd758534e21a68dfc934cf5dff3fe4183986df51
Time: 2021-01-06
Author: gardener@tensorflow.org
File Name: tensorflow/python/keras/utils/version_utils.py
Class Name:
Method Name: swap_class


Project Name: analysiscenter/batchflow
Commit Name: 378c2b621623d2137541aca4a40c81b8d63a10be
Time: 2017-04-29
Author: roman-kh@users.noreply.github.com
File Name: dataset/batch.py
Class Name: Batch
Method Name: __getitem__


Project Name: keras-team/keras
Commit Name: bf464d7ed9283988fea1f548a11a0171fd2ff364
Time: 2021-01-06
Author: gardener@tensorflow.org
File Name: keras/utils/version_utils.py
Class Name:
Method Name: swap_class