Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

keras - Need help getting my observation space in the right shape (OpenAI+Tensorflow)

I'm trying to create a custom open ai gym environment and I'm struggling to understand how to get my observation space set up correctly.

Lets say I want my observation space to have 4 values, each with a minimum of -4 and a max of 4. I define the observation space like this in my environment's init function:

self.observation_space = Box(low = np.array([-4, -4, -4, -4]), high = np.array([4, 4, 4, 4]))

but when I go to fit my dqn model, I get this error:

"ValueError: Error when checking input: expected dense_3_input to have 2 dimensions, but got array with shape (1, 1, 4)"

If anyone can help me understand what I've done wrong I'd really appreciate it. Thanks

question from:https://stackoverflow.com/questions/65918525/need-help-getting-my-observation-space-in-the-right-shape-openaitensorflow

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...