Skip to content

Commit 0d52fef

Browse files
policy states
1 parent 4f4b934 commit 0d52fef

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

index.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ let model = null
6565
class Policy{
6666
constructor(){
6767
this.step = 0
68-
this.states = null
68+
this.policy_states = null
6969
}
7070
get_observation(state, obs){
7171
let vehicle_state = null
@@ -110,8 +110,8 @@ class Policy{
110110
}
111111
}
112112
evaluate_step(states) {
113-
if(!this.states || this.states.length !== states.length){
114-
this.states = states.map(() => null)
113+
if(!this.policy_states || this.policy_states.length !== states.length){
114+
this.policy_states = states.map(() => null)
115115
}
116116
return states.map((state, i) => {
117117
state.observe()
@@ -121,18 +121,19 @@ class Policy{
121121
input_offset.forEach((x, i) => {
122122
input._data[0][i] = input._data[0][i] - x
123123
})
124-
const [output, new_state] = model.evaluate_step(input, this.states[i])
125-
this.states[i] = new_state
124+
const [output, new_state] = model.evaluate_step(input, this.policy_states[i])
125+
this.policy_states[i] = new_state
126126
this.step += 1
127127
return output.valueOf()[0]
128128
})
129129
}
130130
reset() {
131131
this.step = 0
132-
this.states = null
132+
this.policy_states = null
133133
}
134134
}
135135

136+
136137
function arrayBufferToBase64(buffer) {
137138
const bytes = new Uint8Array(buffer);
138139
let binary = '';

0 commit comments

Comments
 (0)