mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-05 08:15:58 +08:00
23 lines
740 B
Python
23 lines
740 B
Python
import io
|
|
|
|
import numpy as np
|
|
|
|
from openpilot.selfdrive.modeld.helpers import dump_oob, load_oob, tinygrad_dev_config
|
|
|
|
|
|
def test_external_gpu_keeps_the_native_device_available():
|
|
assert tinygrad_dev_config(True, tici=True) == "QCOM;USB+AMD:LLVM"
|
|
assert tinygrad_dev_config(False, tici=True) == "QCOM"
|
|
assert tinygrad_dev_config(True, tici=False) == "CPU:LLVM;USB+AMD:LLVM"
|
|
|
|
|
|
def test_out_of_band_artifact_round_trip():
|
|
artifact = {"weights": np.arange(32, dtype=np.float32), "metadata": {"version": 1}}
|
|
stream = io.BytesIO()
|
|
dump_oob(artifact, stream)
|
|
stream.seek(0)
|
|
|
|
restored = load_oob(stream)
|
|
assert restored["metadata"] == artifact["metadata"]
|
|
np.testing.assert_array_equal(restored["weights"], artifact["weights"])
|