-
Notifications
You must be signed in to change notification settings - Fork 83
Closed
Description
Current implement will first cast inputs to float, do a true divide then floor. If inputs are big int64, it may case precision loss.
@torch_op("aten::floor_divide", trace_only=True)
def aten_floor_divide_int(self: TInt, other: TInt) -> TInt:
"""floor_divide(Tensor self, Tensor other) -> Tensor"""
# TODO(justinchuby): This can be simplified if we can constrain the
# inputs to be positive integers. Consider how we can embed constraints in the model.
dtype = self.dtype
self = op.Cast(self, to=FLOAT.dtype)
other = op.Cast(other, to=FLOAT.dtype)
result = op.Floor(op.Div(self, other))
return op.Cast(result, to=dtype)
Metadata
Metadata
Assignees
Labels
No labels