555ca942df407b8c1bf1d48383c60fa1bf09cc1d,keras/engine/network.py,Network,losses,#Network#,417

Before Change


        // Add any potential unconditional model-level loss.
        losses += self.get_losses_for(None)

        unique_tensors = list(
            set(x for x in losses if not isinstance(x, (float, int))))
        non_tensors = [x for x in losses if isinstance(x, (float, int))]
        return unique_tensors + non_tensors

    @property

After Change



        unique_tensors = []
        unique_tensors_ids = set()
        for x in losses:
            if not isinstance(x, (float, int)):
                if id(x) not in unique_tensors_ids:
                    unique_tensors.append(x)
                    unique_tensors_ids.add(id(x))
        non_tensors = [x for x in losses if isinstance(x, (float, int))]
        return unique_tensors + non_tensors

    @property
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: keras-team/keras
Commit Name: 555ca942df407b8c1bf1d48383c60fa1bf09cc1d
Time: 2019-08-28
Author: francois.chollet@gmail.com
File Name: keras/engine/network.py
Class Name: Network
Method Name: losses


Project Name: keras-team/autokeras
Commit Name: 68e0442cd7c9e28e2d1a0ca41dac64297fad858a
Time: 2018-08-30
Author: jhfjhfj1@gmail.com
File Name: autokeras/net_transformer.py
Class Name:
Method Name: transform


Project Name: keras-team/autokeras
Commit Name: 504d63d25cfd42e650834d8db6d976103e5f4baa
Time: 2018-09-03
Author: jhfjhfj1@gmail.com
File Name: autokeras/net_transformer.py
Class Name:
Method Name: transform