@@ -692,6 +692,31 @@ def sample_inputs__fft_c2r(self, device, dtype, requires_grad=False, **_):
692692 )
693693
694694
695+ def _index_variable_bool (shape , max_indices , device ):
696+ if not isinstance (shape , tuple ):
697+ shape = (shape ,)
698+ index = (
699+ torch .rand (* shape , dtype = torch .double , device = device ).mul_ (max_indices ).floor_ ().bool ()
700+ )
701+ return index
702+
703+
704+ def sample_inputs_index_bool (op_info , device , dtype , requires_grad , ** kwargs ):
705+ del op_info # Unused
706+ del kwargs # Unused
707+ make_arg = functools .partial (
708+ torch_testing .make_tensor , dtype = dtype , device = device , requires_grad = requires_grad
709+ )
710+ s = 5
711+ index_bool = _index_variable_bool (s , s , device = device )
712+ test_args = [
713+ ([index_bool ],),
714+ ]
715+
716+ for args in test_args :
717+ yield opinfo_core .SampleInput (make_arg ((s , s , s , s )), args = args )
718+
719+
695720def sample_inputs_index (op_info , device , dtype , requires_grad , ** kwargs ):
696721 del op_info # Unused
697722 del kwargs # Unused
@@ -1933,6 +1958,15 @@ def __init__(self):
19331958 ),
19341959 sample_inputs_func = sample_inputs_index ,
19351960 ),
1961+ opinfo_core .OpInfo (
1962+ "ops.aten.index.Tensor.bool" ,
1963+ aten_name = "index.Tensor" ,
1964+ dtypes = common_dtype .all_types_and_complex_and (
1965+ torch .bool , torch .float16 , torch .bfloat16 , torch .chalf
1966+ ),
1967+ sample_inputs_func = sample_inputs_index_bool ,
1968+ op = torch .ops .aten .index .Tensor ,
1969+ ),
19361970 opinfo_core .OpInfo (
19371971 "ops.aten.layer_norm" ,
19381972 aten_name = "layer_norm" ,
0 commit comments