Skip to content

Commit e898f75

Browse files
committed
Fix 0.4.0 related issues
1 parent 895c82a commit e898f75

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

my_optim.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ def step(self, closure=None):
6262

6363
denom = exp_avg_sq.sqrt().add_(group['eps'])
6464

65-
bias_correction1 = 1 - beta1**state['step'][0]
66-
bias_correction2 = 1 - beta2**state['step'][0]
65+
bias_correction1 = 1 - beta1 ** state['step'].item()
66+
bias_correction2 = 1 - beta2 ** state['step'].item()
6767
step_size = group['lr'] * math.sqrt(
6868
bias_correction2) / bias_correction1
6969

train.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def train(rank, args, shared_model, counter, lock, optimizer=None):
5757
entropy = -(log_prob * prob).sum(1, keepdim=True)
5858
entropies.append(entropy)
5959

60-
action = prob.multinomial().data
60+
action = prob.multinomial(num_samples=1).data
6161
log_prob = log_prob.gather(1, Variable(action))
6262

6363
state, reward, done, _ = env.step(action.numpy())

0 commit comments

Comments
 (0)