Hi I’m training DRL. I met a problem showing below after updating to torch 1.8.1+cu111. I’ve used the previous nightly version before. It was okay. Is it related to version problem? Thanks…
File "/home/jeff/VirtualEnv/openai_py38/lib/python3.8/site-packages/torch/distributions/transforms.py", line 287, in domain
domain = self.parts[0].domain
AttributeError: 'TanhBijector' object has no attribute 'domain
And this is my class using “torch.distributions.Transform”. I’ve tried to add 2 variables, self.domain and self.codomain. Then, it seems that it should be defined by other terms.
class TanhBijector(torch.distributions.Transform):
def __init__(self):
super().__init__()
self.bijective = True
#self.domain = [0,1]
#self.codomain = [0,1]
@property
def sign(self): return 1.
def _call(self, x): return torch.tanh(x)
def _inverse(self, y: torch.Tensor):
y = torch.where(
(torch.abs(y) <= 1.),
torch.clamp(y, -0.99999997, 0.99999997),
y)
y = atanh(y)
return y
def log_abs_det_jacobian(self, x, y):
return 2. * (np.log(2) - x - F.softplus(-2. * x))