40ec35876d38c4797ad3ee9bf911b019faa5a61d,allennlp/nn/initializers.py,InitializerApplicator,__call__,#InitializerApplicator#Any#,149

Before Change



        logger.info("Initializing remaining parameters with default initializer: %s",
                    self._default_initializer)
        for name, parameter in not_explicitly_initialized_parameters:
            if any(re.search(exclude_regex, name) for exclude_regex in self._exclude):
                logger.info("Excluding %s from default initialization", name)
            else:
                logger.info("Initializing %s using the default initializer", name)
                self._default_initializer(parameter)

    @classmethod
    def from_params(cls, params: Params) -> "InitializerApplicator":
        
        Converts a Params object into an InitializerApplicator. The json should

After Change


            The Pytorch module to apply the initializers to.
        
        logger.info("Initializing parameters")
        unused_regexes = set([initializer[0] for initializer in self._initializers])
        uninitialized_parameters = set()
        // Store which initialisers were applied to which parameters.
        for name, parameter in module.named_parameters():
            for initializer_regex, initializer in self._initializers:
                if re.search(initializer_regex, name):
                    logger.info("Initializing %s using %s intitializer", name, initializer_regex)
                    initializer(parameter)
                    unused_regexes.discard(initializer_regex)
                    break
            else:  // no break
                uninitialized_parameters.add(name)
        for regex in unused_regexes:
            logger.warning("Did not use initialization regex that was passed: %s", regex)
        logger.info("Done initializing parameters; the following parameters are using their "
                    "default initialization from their code")
        for name in uninitialized_parameters:
            logger.info("   %s", name)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: allenai/allennlp
Commit Name: 40ec35876d38c4797ad3ee9bf911b019faa5a61d
Time: 2017-08-25
Author: mattg@allenai.org
File Name: allennlp/nn/initializers.py
Class Name: InitializerApplicator
Method Name: __call__


Project Name: GoogleCloudPlatform/PerfKitBenchmarker
Commit Name: 225d31587eeb9aca226158e346c8e9730777913c
Time: 2017-02-24
Author: nlavine@google.com
File Name: perfkitbenchmarker/publisher.py
Class Name:
Method Name: RepublishJSONSamples


Project Name: kubeflow/kubeflow
Commit Name: 67aa5e8bd0e8a429b710df4086f2fd1ccafa02c8
Time: 2019-10-12
Author: jeremy+github@lewi.us
File Name: testing/kfctl/kf_is_ready_test.py
Class Name:
Method Name: test_kf_is_ready