tristandeleu/pytorch-maml-rl

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

Closed this issue · 4 comments

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.

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

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?

@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. :)

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