ce96b03b07a4a4bdd851aa84493c616cd291aff2,rllib/models/torch/torch_modelv2.py,TorchModelV2,variables,#TorchModelV2#Any#,50

Before Change


    @override(ModelV2)
    def variables(self, as_dict: bool = False) -> List[TensorType]:
        if as_dict:
            return self.state_dict()
        return list(self.parameters())

    @override(ModelV2)
    def trainable_variables(self, as_dict: bool = False) -> List[TensorType]:

After Change


    def variables(self, as_dict: bool = False) -> List[TensorType]:
        p = list(self.parameters())
        if as_dict:
            return {k: p[i] for i, k in enumerate(self.state_dict().keys())}
        return p

    @override(ModelV2)
    def trainable_variables(self, as_dict: bool = False) -> List[TensorType]:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: ray-project/ray
Commit Name: ce96b03b07a4a4bdd851aa84493c616cd291aff2
Time: 2020-10-06
Author: sven@anyscale.io
File Name: rllib/models/torch/torch_modelv2.py
Class Name: TorchModelV2
Method Name: variables


Project Name: ray-project/ray
Commit Name: 86cff17e7ef1b355e1ab4862ccd664ed4c856227
Time: 2020-03-30
Author: rliaw@berkeley.edu
File Name: python/ray/util/sgd/torch/distributed_torch_runner.py
Class Name: DistributedTorchRunner
Method Name: _get_model_state_dicts


Project Name: ray-project/ray
Commit Name: 86cff17e7ef1b355e1ab4862ccd664ed4c856227
Time: 2020-03-30
Author: rliaw@berkeley.edu
File Name: python/ray/util/sgd/torch/torch_runner.py
Class Name: TorchRunner
Method Name: _get_model_state_dicts