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

Before Change



def _instrument_model(model, wrappers):
    // Replace layers to wrappers
    for wrapper in reversed(wrappers):
        cur = model
        for key in wrapper.layer_info.path[:-1]:
            if isinstance(key, str):

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:
                    setattr(model, key, new_layer)
            elif isinstance(value, list):
                for i, item in enumerate(value):
                    if isinstance(item, tf.keras.layers.Layer):
                        value[i] = self._instrument(item)
        return model


    def _select_config(self, layer):
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: metagenome-atlas/atlas
Commit Name: 0efcba3479ba1899c660eaff69afe0c57418adb8
Time: 2019-10-20
Author: silas.kieser@gmail.com
File Name: atlas/scripts/utils/tree.py
Class Name:
Method Name: root_tree_by_phyla


Project Name: OpenNMT/OpenNMT-py
Commit Name: a850f4a77146f79da97a151281e474ee0cd70d1b
Time: 2019-02-01
Author: guillaumekln@users.noreply.github.com
File Name: onmt/utils/loss.py
Class Name:
Method Name: shards