e68eec29ab5d7d58cf88068b1211d0fe6a1df904,scripts/dump-model-params.py,,,#,67

Before Change



    // save variables that are GLOBAL, and either TRAINABLE or MODEL
    var_to_dump = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES)
    var_to_dump.extend(tf.get_collection(tf.GraphKeys.MODEL_VARIABLES))
    if len(set(var_to_dump)) != len(var_to_dump):
        logger.warn("TRAINABLE and MODEL variables have duplication!")
    var_to_dump = list(set(var_to_dump))
    globvarname = set([k.name for k in tf.global_variables()])

After Change


        dic = varmanip.load_chkpt_vars(input)
    dic = {get_op_tensor_name(k)[1]: v for k, v in six.iteritems(dic)}

    if args.meta is not None:
        // save variables that are GLOBAL, and either TRAINABLE or MODEL
        var_to_dump = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES)
        var_to_dump.extend(tf.get_collection(tf.GraphKeys.MODEL_VARIABLES))
        if len(set(var_to_dump)) != len(var_to_dump):
            logger.warn("TRAINABLE and MODEL variables have duplication!")
        var_to_dump = list(set(var_to_dump))
        globvarname = set([k.name for k in tf.global_variables()])
        var_to_dump = set([k.name for k in var_to_dump if k.name in globvarname])

        for name in var_to_dump:
            assert name in dic, "Variable {} not found in the model!".format(name)
    else:
        var_to_dump = set(dic.keys())

    dic_to_dump = {k: v for k, v in six.iteritems(dic) if k in var_to_dump}
    varmanip.save_chkpt_vars(dic_to_dump, args.output)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 5

Instances


Project Name: tensorpack/tensorpack
Commit Name: e68eec29ab5d7d58cf88068b1211d0fe6a1df904
Time: 2019-09-04
Author: ppwwyyxx@users.noreply.github.com
File Name: scripts/dump-model-params.py
Class Name:
Method Name:


Project Name: OpenNMT/OpenNMT-py
Commit Name: 284b78172fc5072c9aef5d6980d9ea47bb511dee
Time: 2017-12-17
Author: sasha.rush@gmail.com
File Name: opts.py
Class Name: MarkdownHelpFormatter
Method Name: _format_action


Project Name: chainer/chainercv
Commit Name: 4fda6d1c940396029a054aa5157524912fc6afa2
Time: 2018-04-10
Author: Hakuyume@users.noreply.github.com
File Name: examples/ssd/train_multi.py
Class Name:
Method Name: main


Project Name: tryolabs/luminoth
Commit Name: 055b18ea9dea5a25fe60a6906dd6bc0a3354c3ca
Time: 2018-03-20
Author: psoto23.ps@gmail.com
File Name: luminoth/utils/image_vis.py
Class Name:
Method Name: image_vis_summaries