Skip to content

Commit

Permalink
Fixed failing ivy test for randint by reverting recent changes and ad…
Browse files Browse the repository at this point in the history
…justing typecasting (ivy-llc#10592)
  • Loading branch information
vedpatwardhan authored Feb 16, 2023
1 parent 087cfbd commit 8229722
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ivy/functional/backends/torch/random.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,13 @@ def randint(
) -> torch.Tensor:
if not dtype:
dtype = ivy.default_int_dtype()
if not shape:
shape = (1,)
dtype = ivy.as_native_dtype(dtype)
_randint_check_dtype_and_bound(low, high, dtype)
shape = _check_bounds_and_get_shape(low, high, shape)
rand_range = high - low
if seed:
torch.manual_seed(seed)
return torch.randint(low=low, high=high, size=shape, device=device, dtype=dtype)
return (torch.rand(shape, device=device) * rand_range + low).to(dtype)


def seed(*, seed_value: int = 0) -> None:
Expand Down

0 comments on commit 8229722

Please sign in to comment.