928f1d0b3ba401ea7614f19f3595e1a44c171205,maml_rl/utils/torch_utils.py,,detach_distribution,#Any#,36
Before Change
elif isinstance(pi, Normal):
distribution = Normal(loc=pi.loc.detach(), scale=pi.scale.detach())
else:
raise NotImplementedError("Only `Categorical` and `Normal` "
"policies are valid policies.")
return distribution
def to_numpy(tensor):
if isinstance(tensor, torch.Tensor):
After Change
return out
def detach_distribution(pi):
if isinstance(pi, Independent):
distribution = Independent(detach_distribution(pi.base_dist),
pi.reinterpreted_batch_ndims)
elif isinstance(pi, Categorical):
distribution = Categorical(logits=pi.logits.detach())
elif isinstance(pi, Normal):
distribution = Normal(loc=pi.loc.detach(), scale=pi.scale.detach())
else:
raise NotImplementedError("Only `Categorical`, `Independent` and "
"`Normal` policies are valid policies. Got "
"`{0}`.".format(type(pi)))
return distribution
def to_numpy(tensor):
if isinstance(tensor, torch.Tensor):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 6
Instances
Project Name: tristandeleu/pytorch-maml-rl
Commit Name: 928f1d0b3ba401ea7614f19f3595e1a44c171205
Time: 2020-01-11
Author: tristan.deleu@gmail.com
File Name: maml_rl/utils/torch_utils.py
Class Name:
Method Name: detach_distribution
Project Name: hyperspy/hyperspy
Commit Name: 3a87faf42dd2b00b99184270eb798b7bdf8c2301
Time: 2017-05-23
Author: frandelapena@gmail.com
File Name: hyperspy/ui_registry.py
Class Name:
Method Name: get_gui
Project Name: datascienceinc/Skater
Commit Name: 6fa6f35f04cd50e1cf75ba9e570e1ec3781cc263
Time: 2017-05-05
Author: aikramer2@gmail.com
File Name: lynxes/data/dataset.py
Class Name: DataManager
Method Name: generate_column_sample