Skip to content

Commit f06ee3e

Browse files
pralay-daspytorchmergebot
authored andcommitted
[pt2] Add meta for _add_relu (#140009)
aten._add_relu doesn't have meta function registered, so in dynamic shape case it is throwing an error in dynamo logs: Error: `V1107 11:25:32.344000 140481543555072 torch/_dynamo/symbolic_convert.py:534] [0/1] [__graph_breaks] NotImplementedError: aten::_add_relu.Tensor: attempted to run this operator with Meta tensors, but there was no fake impl or Meta kernel registered. You may have run into this message while using an operator with PT2 compilation APIs (torch.compile/torch.export); in order to use this operator with those APIs you'll need to add a fake impl.` Pull Request resolved: #140009 Approved by: https://github.com/ezyang
1 parent 8a80cee commit f06ee3e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

torch/_meta_registrations.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3712,6 +3712,14 @@ def meta_relu_(self):
37123712
return self
37133713

37143714

3715+
@register_meta(aten._add_relu.Tensor)
3716+
@out_wrapper()
3717+
def meta__add_relu(self, other, alpha=1) -> Tensor:
3718+
return elementwise_meta(
3719+
self, other, type_promotion=ELEMENTWISE_TYPE_PROMOTION_KIND.DEFAULT
3720+
)
3721+
3722+
37153723
@register_meta([aten.index_put.default, aten._unsafe_index_put.default])
37163724
def meta_index_put(self, indices, values, accumulate=False):
37173725
return torch.empty_like(self)

0 commit comments

Comments
 (0)