mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-07-25 14:02:06 +08:00
Refactor formatting in model_runner.py for readability.
Consolidated multiline function declarations and calls into single lines where appropriate to improve code readability and maintainability. No changes were made to the functionality.
This commit is contained in:
@@ -63,11 +63,7 @@ class TinyGradRunner(ModelRunner):
|
||||
# Initialize image tensors if not already done
|
||||
for key in imgs_cl:
|
||||
if key not in self.tensor_inputs:
|
||||
self.tensor_inputs[key] = qcom_tensor_from_opencl_address(
|
||||
imgs_cl[key].mem_address,
|
||||
self.input_shapes[key],
|
||||
dtype=dtypes.uint8
|
||||
)
|
||||
self.tensor_inputs[key] = qcom_tensor_from_opencl_address(imgs_cl[key].mem_address, self.input_shapes[key], dtype=dtypes.uint8)
|
||||
|
||||
# Update numpy inputs
|
||||
for k, v in numpy_inputs.items():
|
||||
@@ -98,13 +94,8 @@ class ONNXRunner(ModelRunner):
|
||||
return self.runner.run(None, inputs)[0].flatten()
|
||||
|
||||
|
||||
def create_model_runner(
|
||||
model_path: Path,
|
||||
metadata_path: Path,
|
||||
frames: dict[str, DrivingModelFrame],
|
||||
tinygrad_path: Path | None = None,
|
||||
is_tici: bool = False
|
||||
) -> ModelRunner:
|
||||
def create_model_runner(model_path: Path, metadata_path: Path, frames: dict[str, DrivingModelFrame], tinygrad_path: Path | None = None,
|
||||
is_tici: bool = False) -> ModelRunner:
|
||||
"""Factory function to create appropriate model runner based on hardware."""
|
||||
if is_tici:
|
||||
return TinyGradRunner(tinygrad_path or model_path, metadata_path, frames)
|
||||
|
||||
Reference in New Issue
Block a user