Skip to content

Commit

Permalink
one bug at a time
Browse files Browse the repository at this point in the history
  • Loading branch information
will-maclean committed Sep 1, 2024
1 parent 5c9ea16 commit d924594
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/common/distributions/action_distribution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl<B: Backend> DiagGaussianDistribution<B> {
log_std: Param::from_tensor(
Tensor::ones(Shape::new([action_dim]), device).mul_scalar(log_std_init),
),
dist: dist.no_grad(),
dist,
}
}
}
Expand Down Expand Up @@ -116,10 +116,12 @@ impl<B: Backend> ActionDistribution<B> for DiagGaussianDistribution<B> {

let loc = self.means.forward(obs);

self.dist = Normal::new(loc.clone(), scale);

if deterministic {
loc
} else {
Normal::new(loc, scale).sample()
self.dist.sample()
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/env/classic_control/pendulum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ impl Env<Vec<f32>, Vec<f32>> for PendulumEnv {

pub fn make_pendulum(max_steps: Option<usize>) -> Box<dyn Env<Vec<f32>, Vec<f32>>> {
let env = make_pendulum_eval(max_steps);
let env = ScaleRewardWrapper::new(env, 0.01);
// let env = ScaleRewardWrapper::new(env, 0.01);

Box::new(env)
env
}

pub fn make_pendulum_eval(max_steps: Option<usize>) -> Box<dyn Env<Vec<f32>, Vec<f32>>> {
Expand Down

0 comments on commit d924594

Please sign in to comment.