Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tester/api_config/config_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1998,15 +1998,15 @@ def get_exponent_max(value, dtype_max, default_max = 5):
scalar_val = numpy.random.randint(-65535, 65535)
self.numpy_tensor = numpy.array(scalar_val, dtype=self.dtype)
else:
scalar_val = numpy.random.random() - 0.5
scalar_val = (numpy.random.random() - 0.5)*1.2
self.numpy_tensor = numpy.array(scalar_val, dtype=self.dtype)
elif USE_CACHED_NUMPY and self.dtype not in ["int64", "float64"]:
self.numpy_tensor = self.get_cached_numpy(self.dtype, self.shape)
else:
if "int" in self.dtype:
self.numpy_tensor = (numpy.random.randint(-65535, 65535, size=self.shape)).astype(self.dtype)
else:
self.numpy_tensor = (numpy.random.random(self.shape) - 0.5).astype(self.dtype)
self.numpy_tensor = ((numpy.random.random(self.shape) - 0.5)*1.2).astype(self.dtype)

self.dtype = original_dtype
return self.numpy_tensor
Expand Down
16 changes: 7 additions & 9 deletions tools/get_cases_from_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

app = typer.Typer()

def _get_cases(api_name: str, original_csv: str):

def _get_cases(api_name: str, only_diff: bool, original_csv: str):
with (
open(original_csv, "r") as infile,
open(f"filtered_result_{api_name}.csv", "w", newline="") as outfile,
Expand All @@ -26,7 +27,7 @@ def _get_cases(api_name: str, original_csv: str):
last_col = float(row[-1]) if row[-1].strip() else 0
second_last_col = float(row[-2]) if row[-2].strip() else 0

if last_col < 1e-16 and second_last_col < 1e-16:
if only_diff and last_col < 1e-16 and second_last_col < 1e-16:
continue

writer.writerow(row)
Expand All @@ -44,22 +45,19 @@ def _get_cases(api_name: str, original_csv: str):
first_col = row[0]
last_col = float(row[-1]) if row[-1].strip() else 0
second_last_col = float(row[-2]) if row[-2].strip() else 0

if last_col < 1e-16 and second_last_col < 1e-16:
continue
outs.append(row[2].replace('""', '"'))
outfile.write("\n".join(outs))
outfile.write("\n".join(set(outs)))


@app.command()
def get_cases(
api_names: list[str],
only_diff: bool = False,
config_path: Path = Path("TotalStableFull.csv"),
):
for api_name in api_names:
_get_cases(api_name, config_path.as_posix())

_get_cases(api_name, only_diff, config_path.as_posix())


if __name__ == "__main__":
app()
app()