73b21544b0feda16d2e8b69a1fe502aa387b8f89,tensorforce/core/optimizers/tf_optimizer.py,TFOptimizer,get_variables,#TFOptimizer#Any#Any#,125

Before Change


        for variable in self.optimizer.weights:
            name_index = variable.name.rindex("/" + self.name + "/")
            name = variable.name[name_index + len(self.name) + 2: -2]
            if name in self.variables:
                break
            self.variables[name] = variable
        for name, value in self.optimizer._hyper.items():
            if isinstance(value, tf.Variable):
                if name in self.variables:

After Change



    def get_variables(self, only_trainable=False, only_saved=False):
        optimizer = self.optimizer
        while True:
            for variable in optimizer.weights:
                name = "/" + self.name + "/"
                if name in variable.name:
                    name = variable.name[variable.name.rindex(name) + len(name): -2]
                else:
                    name = variable.name[variable.name.rindex("/") + 1: -2]
                self.variables[name] = variable
            for name, value in optimizer._hyper.items():
                if isinstance(value, tf.Variable):
                    self.variables[name] = value
            if hasattr(optimizer, "_ema"):
                for variable in optimizer._ema._averages.values():
                    assert variable.name.startswith("agent/") and \
                        variable.name.endswith("/ExponentialMovingAverage:0")
                    self.variables[variable.name[:-2]] = variable
            if hasattr(optimizer, "_optimizer"):
                optimizer = optimizer._optimizer
            else:
                break

        variables = super().get_variables(only_trainable=only_trainable, only_saved=only_saved)

        return variables
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: reinforceio/tensorforce
Commit Name: 73b21544b0feda16d2e8b69a1fe502aa387b8f89
Time: 2019-11-30
Author: alexkuhnle@t-online.de
File Name: tensorforce/core/optimizers/tf_optimizer.py
Class Name: TFOptimizer
Method Name: get_variables


Project Name: Logan1x/Python-Scripts
Commit Name: 2ef5c047b4296a807eea8366f67d7f271f0d47de
Time: 2020-06-28
Author: 59202862+Monsieurvishal@users.noreply.github.com
File Name: bin/password-strength-checker.py
Class Name:
Method Name: pass1


Project Name: lmcinnes/pynndescent
Commit Name: c0a393e873fb6bbf469fc83fc563aba785c2f246
Time: 2019-09-12
Author: leland.mcinnes@gmail.com
File Name: pynndescent/pynndescent_.py
Class Name:
Method Name: initialized_nnd_search