Skip to content
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

ValueError: could not broadcast input array from shape (2) into shape (7,1,5) #246

Closed
hn2 opened this issue Mar 26, 2019 · 1 comment
Closed
Labels
duplicate This issue or pull request already exists

Comments

@hn2
Copy link

hn2 commented Mar 26, 2019

If you have any questions, feel free to create an issue with the tag [question].
If you wish to suggest an enhancement or feature request, add the tag [feature request].
If you are submitting a bug report, please fill in the following details.

Describe the bug
I am trying to run stable_baseline alogs such as ppo1, ddpg and get this error:
ValueError: could not broadcast input array from shape (2) into shape (7,1,5)

Code example

action will be the portfolio weights from 0 to 1 for each asset

    self.action_space = gym.spaces.Box(-1, 1, shape=(len(instruments) + 1,), dtype=np.float32)  # include cash

    # get the observation space from the data min and max
    self.observation_space = gym.spaces.Box(low=-np.inf, high=np.inf, shape=(len(instruments), window_length, history.shape[-1]), dtype=np.float32)

I tried using obs.reshape(-1), obs.flatten(), obs.ravel() nothing works. Also tried CnnPolicy onstead of MlpPolicy and got:

ValueError: Negative dimension size caused by subtracting 8 from 7 for 'model/c1/Conv2D' (op: 'Conv2D') with input shapes: [?,7,1,5], [8,8,5,32].

System Info
Describe the characteristic of your environment:
*library was installed using:
git clone https://github.com/hill-a/stable-baselines.git
cd stable-baselines
pip install -e .

  • GPU models and configuration: no gpu, cpu only
  • Python 3.7.2
  • tensorflow 1.12.0
  • stable-baselines 2.4.1

Additional context
Add any other context about the problem here.

@araffin
Copy link
Collaborator

araffin commented Mar 26, 2019

Closing because main discussion is happening in the original issue #242 .

@araffin araffin closed this as completed Mar 26, 2019
@araffin araffin added the duplicate This issue or pull request already exists label Mar 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants