mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[dynamo] Make filter handle None as filter function (#159500)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/159500 Approved by: https://github.com/guilhermeleobas, https://github.com/zou3519 ghstack dependencies: #158774, #159102
This commit is contained in:
committed by
PyTorch MergeBot
parent
fa68216ca1
commit
8becf646ef
@ -514,7 +514,10 @@ class FilterVariable(IteratorVariable):
|
||||
while True:
|
||||
item = _next()
|
||||
self.index += 1
|
||||
res = self.fn.call_function(tx, [item], {})
|
||||
if isinstance(self.fn, ConstantVariable) and self.fn.value is None:
|
||||
res = item
|
||||
else:
|
||||
res = self.fn.call_function(tx, [item], {})
|
||||
pred_res = variables.UserFunctionVariable(
|
||||
polyfills.predicate
|
||||
).call_function(tx, [res], {})
|
||||
|
Reference in New Issue
Block a user