check every feature

This commit is contained in:
Eason 2024-06-12 23:05:45 +08:00
parent d42bdb758c
commit 4558abf160
1 changed files with 7 additions and 5 deletions

View File

@ -124,7 +124,7 @@ impl<'a> Info<'a> {
let angle = self.player.get_angle();
let gun_angle = self.player.get_gun_angle();
[
let feature=[
normalize_angle(target.angle - angle).tanh(),
(wall.distance - target.distance).tanh(),
(self.player.power as f32).tanh(),
@ -132,13 +132,15 @@ impl<'a> Info<'a> {
(emeny.distance + 1.0).log2(),
normalize_angle(emeny.angle - gun_angle).tanh(),
normalize_angle(wall.angle - gun_angle).tanh(),
]
}
pub fn into_feature_tensor<B: Backend>(&self, device: &B::Device) -> Tensor<B, 1> {
let feature = self.into_feature();
];
for feature in feature.iter() {
assert!(!feature.is_nan());
}
feature
}
pub fn into_feature_tensor<B: Backend>(&self, device: &B::Device) -> Tensor<B, 1> {
let feature = self.into_feature();
Tensor::from_floats(feature, device)
}
fn get_target(&self) -> Target {