hotfix: make openpilot test deterministic

This commit is contained in:
George Hotz 2023-12-01 15:37:23 -08:00
parent 9c306be282
commit bfdce1f0e7
1 changed files with 1 additions and 0 deletions

View File

@ -90,6 +90,7 @@ def thneed_test_onnx(onnx_data, output_fn):
onnx_model = onnx.load(io.BytesIO(onnx_data)) onnx_model = onnx.load(io.BytesIO(onnx_data))
input_shapes = {inp.name:tuple(x.dim_value for x in inp.type.tensor_type.shape.dim) for inp in onnx_model.graph.input} input_shapes = {inp.name:tuple(x.dim_value for x in inp.type.tensor_type.shape.dim) for inp in onnx_model.graph.input}
Tensor.manual_seed(1337)
inputs = {k:Tensor.randn(*shp, requires_grad=False)*8 for k,shp in input_shapes.items()} inputs = {k:Tensor.randn(*shp, requires_grad=False)*8 for k,shp in input_shapes.items()}
new_np_inputs = {k:v.realize().numpy() for k,v in inputs.items()} new_np_inputs = {k:v.realize().numpy() for k,v in inputs.items()}