yuriak / RLQuant

Applying Reinforcement Learning in Quantitative Trading
333 stars 103 forks source link

RuntimeError: t() expects a 2D tensor, but self is 3D` #6

Open abk11 opened 5 years ago

abk11 commented 5 years ago

Hi,

Running EnvtestStock_RPG.ipynb I get the following error: `--------------------------------------------------------------------------- RuntimeError Traceback (most recent call last)

in 14 state=next_state 15 if env.pointer%64==0: ---> 16 agent.train() 17 pv,pp,pw=env.get_summary() 18 total_pv=pv.sum(axis=1) in train(self) 73 def train(self): 74 self.optimizer.zero_grad() ---> 75 s = torch.stack(self.s_buffer).t() 76 s_next = torch.stack(self.s_next_buffer).t() 77 r = torch.stack(self.r_buffer).t() RuntimeError: t() expects a 2D tensor, but self is 3D` In particular, self.s_buffer is a list of 54 tensors, each of size: torch.Size([6, 36]) Do you know what might be causing it? Thank you in advance EDIT: my torch version is 1.0.1
ghost commented 5 years ago

I have the same issue.

liiklin commented 5 years ago

try use pytorch 0.4.0?