MCPcopy Create free account
hub / github.com/pytorch/executorch / get_rand_input_values

Function get_rand_input_values

devtools/bundled_program/util/test_util.py:71–87  ·  view source on GitHub ↗
(
    n_tensors: int,
    sizes: List[List[int]],
    n_int: int,
    dtype: torch.dtype,
    n_sets_per_plan_test: int,
    n_method_test_suites: int,
)

Source from the content-addressed store, hash-verified

69
70
71def get_rand_input_values(
72 n_tensors: int,
73 sizes: List[List[int]],
74 n_int: int,
75 dtype: torch.dtype,
76 n_sets_per_plan_test: int,
77 n_method_test_suites: int,
78) -> List[List[MethodInputType]]:
79 # pyre-ignore[7]: expected `List[List[List[Union[bool, float, int, Tensor]]]]` but got `List[List[List[Union[int, Tensor]]]]`
80 return [
81 [
82 [(torch.rand(*sizes[i]) - 0.5).to(dtype) for i in range(n_tensors)]
83 + [DEFAULT_INT_INPUT for _ in range(n_int)]
84 for _ in range(n_sets_per_plan_test)
85 ]
86 for _ in range(n_method_test_suites)
87 ]
88
89
90def get_rand_output_values(

Callers 2

get_random_test_suitesFunction · 0.85

Calls 1

toMethod · 0.45

Tested by

no test coverage detected