tristandeleu / pytorch-maml-rl

Reinforcement Learning with Model-Agnostic Meta-Learning in Pytorch
MIT License
827 stars 158 forks source link

what's the purpose of len(self) in batchepisode when sample #22

Closed ghost closed 6 years ago

ghost commented 6 years ago

What's the purpose of using len(self) in sampling, I'm confused since we have already provide batch_size. With this len(self) , sampled data's shape would be [len(self), batch_size, state_dim], which I can not understand.

tristandeleu commented 6 years ago

The object BatchEpisode contains a batch of multiple episodes. The length of BatchEpisode is the maximum length of each episode in the batch.

ghost commented 6 years ago

Thanks, I understand BatchEpisode contains a batch of episodes , but why the length of BatchEpisode is equals to len(self) and is equals to the episode length?

fengredrum commented 6 years ago

@Andrewtor This code def __len__(self): return max(map(len, self._rewards_list)) overrides the original len() method, and returns the max length of self._rewards_list. :)

ghost commented 6 years ago

@fengredrum Got it, thank you so much!!!