Skip to content

Commit

Permalink
Pt 1.9 breaking fix: __iter__ type hint (#7993)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaushikb11 authored and lexierule committed Jun 17, 2021
1 parent b46e213 commit 808534f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pl_examples/domain_templates/reinforce_learn_Qnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

import argparse
from collections import deque, namedtuple, OrderedDict
from typing import List, Tuple
from typing import Iterator, List, Tuple

import gym
import numpy as np
Expand Down Expand Up @@ -139,7 +139,7 @@ def __init__(self, buffer: ReplayBuffer, sample_size: int = 200) -> None:
self.buffer = buffer
self.sample_size = sample_size

def __iter__(self) -> Tuple:
def __iter__(self) -> Iterator:
states, actions, rewards, dones, new_states = self.buffer.sample(self.sample_size)
for i in range(len(dones)):
yield states[i], actions[i], rewards[i], dones[i], new_states[i]
Expand Down
4 changes: 2 additions & 2 deletions pl_examples/domain_templates/reinforce_learn_ppo.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
[3] https://github.com/sid-sundrani/ppo_lightning
"""
import argparse
from typing import Callable, Iterable, List, Tuple
from typing import Callable, Iterator, List, Tuple

import gym
import torch
Expand Down Expand Up @@ -144,7 +144,7 @@ class ExperienceSourceDataset(IterableDataset):
def __init__(self, generate_batch: Callable):
self.generate_batch = generate_batch

def __iter__(self) -> Iterable:
def __iter__(self) -> Iterator:
iterator = self.generate_batch()
return iterator

Expand Down

0 comments on commit 808534f

Please sign in to comment.