Skip to content
Merged
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
9 changes: 7 additions & 2 deletions backends/arm/test/runner_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,16 +448,21 @@ def run_tosa_ref_model(
), "There are no quantization parameters, check output parameters"
tosa_ref_output = (tosa_ref_output - quant_param.zp) * quant_param.scale

if tosa_ref_output.dtype == np.double:
tosa_ref_output = tosa_ref_output.astype("float32")

# tosa_output is a numpy array, convert to torch tensor for comparison
tosa_ref_outputs.append(torch.from_numpy(tosa_ref_output.astype("float32")))
tosa_ref_outputs.append(torch.from_numpy(tosa_ref_output))

return tosa_ref_outputs


def prep_data_for_save(
data, is_quantized: bool, input_name: str, quant_param: QuantizationParams
):
data_np = np.array(data.detach(), order="C").astype(np.float32)
data_np = np.array(data.detach(), order="C").astype(
f"{data.dtype}".replace("torch.", "")
)

if is_quantized:
assert quant_param.node_name in input_name, (
Expand Down
Loading