8a84a02f44efb38c339c019ab097b00fab3701af,batchflow/models/tf/encoder_decoder.py,EncoderDecoder,decoder,#Any#Any#Any#,278

Before Change


        reverse_order = kwargs.pop("reverse_order")
        skip, upsample, block_args = cls.pop(["skip", "upsample", "blocks"], kwargs)
        base_block = block_args.get("base")
        print("DECODER RO", reverse_order)
        if isinstance(factor, int):
            factor = int(factor ** (1/steps))
            factor = [factor] * steps
        elif not isinstance(factor, list):

After Change


        steps = kwargs.pop("num_stages") or len(inputs)-2
        factor = kwargs.pop("factor") or [2]*steps
        skip, upsample, block_args, order = cls.pop(["skip", "upsample", "blocks", "order"], kwargs)
        order = "".join([item[0] for item in order])
        base_block = block_args.get("base")

        if isinstance(factor, int):
            factor = int(factor ** (1/steps))
            factor = [factor] * steps
        elif not isinstance(factor, list):
            raise TypeError("factor should be int or list of int, but %s was given" % type(factor))

        with tf.variable_scope(name):
            x = inputs[-1]

            for i in range(steps):
                with tf.variable_scope("decoder-"+str(i)):
                    // Skip some of the steps
                    if factor[i] == 1:
                        continue

                    args = {**kwargs, **block_args, **unpack_args(block_args, i, steps)}  // enforce priority of subkeys
                    upsample_args = {**kwargs, **upsample, **unpack_args(upsample, i, steps)}

                    if order == "ub":
                        if upsample.get("layout") is not None:
                            x = cls.upsample(x, factor=factor[i], name="upsample-{}".format(i), **upsample_args)
                        x = base_block(x, name="post", **args)
                    elif order == "bu":
                        x = base_block(x, name="post", **args)
                        if upsample.get("layout") is not None:
                            x = cls.upsample(x, factor=factor[i], name="upsample-{}".format(i), **upsample_args)
                    else:
                        raise ValueError("Unknown order, use one of {"ub", "bu"}")

                    // Combine it with stored encoding of the ~same shape
                    if skip and (i < len(inputs)-2):
                        combine_op = args.get("combine_op")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: analysiscenter/batchflow
Commit Name: 8a84a02f44efb38c339c019ab097b00fab3701af
Time: 2019-09-03
Author: Tsimfer.SA@gazprom-neft.ru
File Name: batchflow/models/tf/encoder_decoder.py
Class Name: EncoderDecoder
Method Name: decoder


Project Name: nicodv/kmodes
Commit Name: bbeebd26abdd2ca6f03bcde5c4045b0b74e3821e
Time: 2016-06-16
Author: nico.devos@autogrid.com
File Name: kmodes/kprototypes.py
Class Name:
Method Name: k_prototypes


Project Name: analysiscenter/batchflow
Commit Name: 8a84a02f44efb38c339c019ab097b00fab3701af
Time: 2019-09-03
Author: Tsimfer.SA@gazprom-neft.ru
File Name: batchflow/models/tf/encoder_decoder.py
Class Name: EncoderDecoder
Method Name: encoder