[dynamo][itertools] refactor itertools.islice to use polyfill (#133876)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/133876
Approved by: https://github.com/jansel
ghstack dependencies: #133769, #133778, #133779, #133864, #133894
This commit is contained in:
Xuehai Pan
2024-08-30 00:47:06 +08:00
committed by PyTorch MergeBot
parent a2566adfb6
commit 7d12e6dceb
5 changed files with 33 additions and 41 deletions

View File

@ -166,12 +166,6 @@ class ItertoolsVariable(VariableTracker):
from_exc=e,
)
return variables.ListIteratorVariable(result, mutable_local=MutableLocal())
elif self.value is itertools.islice:
from .builder import SourcelessBuilder
return tx.inline_user_function_return(
SourcelessBuilder.create(tx, polyfills.islice), args, kwargs
)
elif self.value is itertools.repeat:
if len(args) < 2:
return variables.RepeatIteratorVariable(