131aabe82bc94dd9ce83206596696066feb93f33,art/classifiers/tensorflow.py,TensorflowClassifier,__setstate__,#TensorflowClassifier#Any#,522

Before Change


        // pylint: disable=E0611
        import os
        from art import DATA_PATH
        tf = import_tensorflow_v1()
        from tensorflow.python.saved_model import tag_constants

        full_path = os.path.join(DATA_PATH, state["model_name"])

        graph = tf.Graph()
        sess = tf.Session(graph=graph)
        loaded = tf.saved_model.loader.load(sess, [tag_constants.SERVING], full_path)

        // Recover session
        self._sess = sess

        // Recover input_ph
        input_tensor_name = loaded.signature_def["predict"].inputs["SavedInputPhD"].name
        self._input_ph = graph.get_tensor_by_name(input_tensor_name)

        // Recover output layer
        self._output = graph.get_tensor_by_name(state["_output"])

        // Recover labels" placeholder if any
        if state["_labels_ph"] is not None:
            self._labels_ph = graph.get_tensor_by_name(state["_labels_ph"])

        // Recover loss if any
        if state["_loss"] is not None:
            self._loss = graph.get_tensor_by_name(state["_loss"])

        // Recover loss_grads if any
        if state["_loss_grads"]:
            self._loss_grads = graph.get_tensor_by_name(state["_loss_grads"])
        else:
            self.__dict__.pop("_loss_grads", None)

        // Recover learning if any
        if state["_learning"] is not None:
            self._learning = graph.get_tensor_by_name(state["_learning"])

        // Recover train if any
        if state["_train"] is not None:

After Change


        // pylint: disable=E0611
        import os
        import tensorflow as tf
        if tf.__version__[0] == "2":
            import tensorflow.compat.v1 as tf
            tf.disable_eager_execution()
        from art import DATA_PATH

        full_path = os.path.join(DATA_PATH, state["model_name"])
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 131aabe82bc94dd9ce83206596696066feb93f33
Time: 2019-08-30
Author: beat.buesser@ie.ibm.com
File Name: art/classifiers/tensorflow.py
Class Name: TensorflowClassifier
Method Name: __setstate__


Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 131aabe82bc94dd9ce83206596696066feb93f33
Time: 2019-08-30
Author: beat.buesser@ie.ibm.com
File Name: art/classifiers/tensorflow.py
Class Name: TensorflowClassifier
Method Name: __init__


Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 131aabe82bc94dd9ce83206596696066feb93f33
Time: 2019-08-30
Author: beat.buesser@ie.ibm.com
File Name: art/classifiers/tensorflow.py
Class Name: TensorflowClassifier
Method Name: __setstate__


Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 131aabe82bc94dd9ce83206596696066feb93f33
Time: 2019-08-30
Author: beat.buesser@ie.ibm.com
File Name: art/classifiers/tensorflow.py
Class Name: TensorflowClassifier
Method Name: _init_class_grads