Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
baselines
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
xzhaoma
baselines
Commits
dc836c20
Commit
dc836c20
authored
5 years ago
by
Guillaume Mollard
Browse files
Options
Downloads
Patches
Plain Diff
modified preprocessor to include predictor
parent
f80e77a6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
RLLib_training/custom_preprocessors.py
+4
-4
4 additions, 4 deletions
RLLib_training/custom_preprocessors.py
with
4 additions
and
4 deletions
RLLib_training/custom_preprocessors.py
+
4
−
4
View file @
dc836c20
...
@@ -49,13 +49,13 @@ def norm_obs_clip(obs, clip_min=-1, clip_max=1):
...
@@ -49,13 +49,13 @@ def norm_obs_clip(obs, clip_min=-1, clip_max=1):
class
CustomPreprocessor
(
Preprocessor
):
class
CustomPreprocessor
(
Preprocessor
):
def
_init_shape
(
self
,
obs_space
,
options
):
def
_init_shape
(
self
,
obs_space
,
options
):
return
(
sum
([
space
.
shape
[
0
]
for
space
in
obs_space
]),
)
#
return (sum([space.shape[0] for space in obs_space]), )
return
((
sum
([
space
.
shape
[
0
]
for
space
in
obs_space
[:
2
]])
+
obs_space
[
2
].
shape
[
0
]
*
obs_space
[
2
].
shape
[
1
])
*
2
,)
return
((
sum
([
space
.
shape
[
0
]
for
space
in
obs_space
[:
2
]])
+
obs_space
[
2
].
shape
[
0
]
*
obs_space
[
2
].
shape
[
1
]),)
def
transform
(
self
,
observation
):
def
transform
(
self
,
observation
):
# if len(observation) == 111:
# if len(observation) == 111:
return
np
.
concatenate
([
norm_obs_clip
(
obs
)
for
obs
in
observation
])
#
return np.concatenate([norm_obs_clip(obs) for obs in observation])
#
return np.concatenate([norm_obs_clip(observation[0]
[0]
), observation[
0][
1], observation[
0][
2].flatten(), norm_obs_clip(observation[1]), observation[2], observation[3].flatten()])
return
np
.
concatenate
([
norm_obs_clip
(
observation
[
0
]),
observation
[
1
],
observation
[
2
].
flatten
()
])
#
, norm_obs_clip(observation[1]), observation[2], observation[3].flatten()])
#one_hot = observation[-3:]
#one_hot = observation[-3:]
#return np.append(obs, one_hot)
#return np.append(obs, one_hot)
# else:
# else:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment