pytorch / pytorch/rl

RuntimeError: batch dimension mismatch

Open
#1,313 2 comments 0 reactions 1 assignee View on GitHub

@vmoens is already working on this.

Since Jun 26, 2023.

bug
Dominant language
Python
Stars
3.6k
Forks
487
Avg merge
1d 1h
Merged PRs (30d)
207

Description

python version is 3.9.16
torchrl version is 0.1.0+a32d2e7
torch version is 2.0.1

when creating a gym Instance:
from torchrl.envs.libs.gym import GymEnv
import torch
device = "cpu" if not torch.has_cuda else "cuda:0"
frame_skip = 1
base_env = GymEnv("InvertedDoublePendulum-v4", device=device, frame_skip=frame_skip)

throw the following exception:
RuntimeError: batch dimension mismatch, got self.batch_size=[] and value.shape[:self.batch_dims]=torch.Size([]) with value tensor([ 0.0663, 0.0682, -0.0238, 0.9977, 0.9997, 0.1421, 0.1762, -0.0032,
0.0000, 0.0000, 0.0000], dtype=torch.float64)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.