File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 10611061
10621062(let [angle-values (torch/linspace (- PI) PI 854 )
10631063 speed-values (torch/linspace 1.0 -1.0 480 )
1064- grid (torch/meshgrid speed-values angle-values :indexing " ij" )
1065- cos-angle (torch/cos (last grid))
1066- sin-angle (torch/sin (last grid))
1064+ grid (torch/meshgrid speed-values angle-values :indexing " ij" )
1065+ cos-angle (torch/cos (last grid))
1066+ sin-angle (torch/sin (last grid))
10671067 observations (torch/stack [(py. cos-angle ravel)
10681068 (py. sin-angle ravel)
10691069 (py. (first grid) ravel)]
10701070 :axis 1 )
1071- actions (without-gradient (py. (py. (py. actor deterministic_act observations) reshape 480 854 ) numpy))
1072- actions-tensor (dtype/elemwise-cast (dtt/ensure-tensor (py/->jvm actions)) :float32 )]
1071+ actions (without-gradient
1072+ (py. (py. (py. actor deterministic_act observations)
1073+ reshape 480 854 ) numpy))
1074+ actions-tensor (dtype/elemwise-cast (dtt/ensure-tensor (py/->jvm actions))
1075+ :float32 )]
10731076 (bufimg/tensor->image (dfn/* actions-tensor 255 )))
10741077; ; This image shows the motor control input as a function of pendulum angle and angular velocity.
10751078; ; As one can see, the pendulum is decelerated when the speed is high (dark values at the top of the image).
You can’t perform that action at this time.
0 commit comments