Skip to content

Commit 5130ac6

Browse files
Revert "Add randint_like tensor overload for high (pytorch#154899)"
This reverts commit 72fe1d5. Reverted pytorch#154899 on behalf of https://github.com/seemethere due to Failing internal tests see https://fburl.com/diff/bai044ob ([comment](pytorch#154899 (comment)))
1 parent 80703ca commit 5130ac6

File tree

6 files changed

+0
-50
lines changed

6 files changed

+0
-50
lines changed

aten/src/ATen/native/TensorFactories.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,28 +1212,6 @@ Tensor randint_like(
12121212
return result.random_(0, high, std::nullopt);
12131213
}
12141214

1215-
Tensor randint_like(
1216-
const Tensor& self,
1217-
const Tensor& high,
1218-
std::optional<ScalarType> dtype,
1219-
std::optional<Layout> layout,
1220-
std::optional<Device> device,
1221-
std::optional<bool> pin_memory,
1222-
std::optional<c10::MemoryFormat> optional_memory_format) {
1223-
TORCH_CHECK(
1224-
high.numel() == 1 && high.ndimension() == 0 && high.device().is_cpu(),
1225-
"high must be a scalar tensor and on CPU");
1226-
int64_t high_scalar = high.item<int64_t>();
1227-
return at::native::randint_like(
1228-
self,
1229-
high_scalar,
1230-
dtype,
1231-
layout,
1232-
device,
1233-
pin_memory,
1234-
optional_memory_format);
1235-
}
1236-
12371215
Tensor randint_like(
12381216
const Tensor& self,
12391217
int64_t low,

aten/src/ATen/native/native_functions.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4781,14 +4781,6 @@
47814781
CompositeExplicitAutograd: randint_like
47824782
autogen: randint_like.out
47834783

4784-
- func: randint_like.Tensor(Tensor self, Tensor high, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None, MemoryFormat? memory_format=None) -> Tensor
4785-
tags: nondeterministic_seeded
4786-
dispatch:
4787-
# NB: Although this composite mutates on the inside, it is
4788-
# non-differentiable so NonFunctional doesn't apply
4789-
CompositeExplicitAutograd: randint_like
4790-
autogen: randint_like.Tensor_out
4791-
47924784
- func: randint_like.low_dtype(Tensor self, SymInt low, SymInt high, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None, MemoryFormat? memory_format=None) -> Tensor
47934785
tags: nondeterministic_seeded
47944786
dispatch:

test/dynamo/test_misc.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12603,17 +12603,6 @@ def f():
1260312603
res = opt_f()
1260412604
self.assertEqual(ref, res)
1260512605

12606-
def test_randint_no_graphbreak(self):
12607-
@torch.compile(backend="aot_eager", fullgraph=True)
12608-
def f(actions, n_act, epsilon=0.1):
12609-
actions_random = torch.randint_like(actions, n_act)
12610-
12611-
return actions_random
12612-
12613-
x = torch.ones([1], dtype=torch.int64)
12614-
y = torch.tensor(5)
12615-
f(x, y)
12616-
1261712606

1261812607
devices = ("cuda", "hpu")
1261912608
instantiate_device_type_tests(MiscTestsDevice, globals(), only_for=devices)

test/expect/HasDecompTest.test_has_decomposition.expect

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,8 +1094,6 @@ aten::randint.low_generator_out
10941094
aten::randint.low_out
10951095
aten::randint.out
10961096
aten::randint_like
1097-
aten::randint_like.Tensor
1098-
aten::randint_like.Tensor_out
10991097
aten::randint_like.low_dtype
11001098
aten::randint_like.low_dtype_out
11011099
aten::randint_like.out

torch/_meta_registrations.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3505,11 +3505,6 @@ def meta_addbmm(self, batch1, batch2, *, beta=1, alpha=1):
35053505
return self.new_empty(self.size())
35063506

35073507

3508-
@register_meta([aten.randint_like.Tensor])
3509-
def meta_randint_like(self, high, **kwargs):
3510-
return self.new_empty(self.size())
3511-
3512-
35133508
@register_meta([aten._fused_adam_.default, aten._fused_adamw_.default])
35143509
def meta__fused_adam_(
35153510
self,

torch/_subclasses/fake_impls.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ def is_noncontiguous_supported(device):
6868
aten.randn_like.default,
6969
aten.randn_like.out,
7070
aten.randint_like.default,
71-
aten.randint_like.Tensor,
72-
aten.randint_like.Tensor_out,
7371
aten.randint_like.out,
7472
aten.randint_like.low_dtype,
7573
aten.randint_like.low_dtype_out,

0 commit comments

Comments
 (0)