mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
[custom op] Use canonical API to constrain unbacked values (#108372)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/108372 Approved by: https://github.com/angelayi, https://github.com/ezyang
This commit is contained in:
parent
33403336fa
commit
35e48e262c
2 changed files with 4 additions and 5 deletions
|
|
@ -782,7 +782,6 @@ def validate_function_matches_schema(
|
|||
compare(kwargonly, schema.arguments.flat_kwarg_only)
|
||||
|
||||
|
||||
|
||||
def infer_schema(prototype_function: typing.Callable) -> str:
|
||||
sig = inspect.signature(prototype_function)
|
||||
|
||||
|
|
|
|||
|
|
@ -137,9 +137,7 @@ class AbstractImplCtx:
|
|||
that depends on the data of the input Tensors.
|
||||
|
||||
Args:
|
||||
min (int): A statically known inclusive lower bound for this symint.
|
||||
min must be at least 2 due to implementation details of
|
||||
torch.compile. Default: 2.
|
||||
min (int): A statically known inclusive lower bound for this symint. Default: 0
|
||||
max (Optional[int]): A statically known inclusive upper bound for this
|
||||
symint. Default: None
|
||||
|
||||
|
|
@ -202,5 +200,7 @@ class AbstractImplCtx:
|
|||
)
|
||||
|
||||
result = self._shape_env.create_unbacked_symint()
|
||||
torch.fx.experimental.symbolic_shapes.constrain_range(result, min=0, max=max)
|
||||
torch.fx.experimental.symbolic_shapes._constrain_range_for_size(
|
||||
result, min=min, max=max
|
||||
)
|
||||
return result
|
||||
|
|
|
|||
Loading…
Reference in a new issue