10d7ece1c34c5533262a54d20d974a3d04f0b7ce,src/sdk/pynni/nni/compression/tensorflow/compressor.py,,_instrument_model,#Any#Any#,289

Before Change


    // Replace layers to wrappers
    for wrapper in reversed(wrappers):
        cur = model
        for key in wrapper.layer_info.path[:-1]:
            if isinstance(key, str):
                cur = getattr(cur, key)
            else:
                name, index = key
                cur = getattr(cur, name)[index]
        key = wrapper.layer_info.path[-1]
        if isinstance(key, str):
            setattr(cur, key, wrapper)
        else:

After Change


        return tf.keras.Sequential(layers) if need_rebuild else seq

    def _instrument_model(self, model):
        for key, value in list(model.__dict__.items()):  // avoid "dictionary keys changed during iteration"
            if isinstance(value, tf.keras.layers.Layer):
                new_layer = self._instrument(value)
                if new_layer is not value:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: Microsoft/nni
Commit Name: 10d7ece1c34c5533262a54d20d974a3d04f0b7ce
Time: 2020-09-15
Author: 40699903+liuzhe-lz@users.noreply.github.com
File Name: src/sdk/pynni/nni/compression/tensorflow/compressor.py
Class Name:
Method Name: _instrument_model


Project Name: scipy/scipy
Commit Name: 9fcb5a8ef300cc14c54e9f2633142f7b5e2ca53f
Time: 2015-07-05
Author: pav@iki.fi
File Name: tools/refguide_check.py
Class Name:
Method Name: main


Project Name: PIQuIL/QuCumber
Commit Name: 472803120727bbeb6a03b4c1d12fb297ce091ffb
Time: 2018-07-31
Author: gtorlai@uwaterloo.ca
File Name: qucumber/quantum_reconstruction.py
Class Name: QuantumReconstruction
Method Name: fit