-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
实现多类型观测值存储和学习 #33
Labels
Comments
StepNeverStop
added a commit
that referenced
this issue
Jan 5, 2021
StepNeverStop
added a commit
that referenced
this issue
Jan 5, 2021
- support multi-vector and multi-visual input - optimize `gym` and `unity` wrapper - fix `ActorCriticValueCts` - tag 2.0.0 - add `ObsSpec` - refactor `SingleAgentEnvArgs` and `MultiAgentEnvArgs` - remove `self.s_dim`, use `self.concat_vector_dim` instead - stop using vector input normalization temporarily
目前已经实现了基于NamedTuple的数据格式,对于智能体的观测状态,其必须被赋值 import sys
import numpy as np
empty10_0 = np.full((10,0), [])
empty1000_0 = np.full((1000,0), [])
random10_1 = np.random.random((10, 1))
random1000_1 = np.random.random((1000, 1))
def f(x):
return sys.getsizeof(x)
print(f(()), f([]), f([[]]),f(np.asarray([])), f(np.asarray([[]])))
print(f(empty10_0), f(empty1000_0), f(random10_1), f(random1000_1)) 最后结果输出为:
由此可见,二维的空numpy数组,无论shape如何,其恒占用112个bytes,不算很多,但是当存储的经验较多时,依旧会空消耗不少内存,因此有待优化。 |
另外,在测试 from typing import NamedTuple
from collections import namedtuple
x = np.random.random((100, 100))
y = np.random.random((100, 100))
NT = NamedTuple('a', [('x', np.ndarray),('y', np.ndarray)])(x, y)
nt = namedtuple('a', 'x, y')(x, y)
t = tuple((x,y))
print(f(x), f(y))
print(f(NT), f(nt), f(t))
print(f(NT.x)) 结果:
|
|
StepNeverStop
added a commit
that referenced
this issue
Jan 6, 2021
StepNeverStop
added a commit
that referenced
this issue
Jan 6, 2021
StepNeverStop
added a commit
that referenced
this issue
Jan 7, 2021
StepNeverStop
added a commit
that referenced
this issue
Jul 4, 2021
StepNeverStop
added a commit
that referenced
this issue
Jul 6, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: