From ace8db29f89028a8ec708e4e7e92d9724dacf1fe Mon Sep 17 00:00:00 2001 From: George Hotz Date: Thu, 20 Oct 2022 12:48:14 -0700 Subject: [PATCH] ReduceSum --- extra/onnx.py | 1 + openpilot/manual_test.sh | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/extra/onnx.py b/extra/onnx.py index 7226ae2a33..cae81bd2d0 100644 --- a/extra/onnx.py +++ b/extra/onnx.py @@ -81,6 +81,7 @@ def get_run_onnx(onnx_model): elif n.op_type == "Squeeze": ret = inp[0].reshape([s for i,s in enumerate(inp[0].shape) if i not in opt['axes']]) elif n.op_type == "Unsqueeze": ret = inp[0].reshape(np.insert(inp[0].shape, opt['axes'][0], 1).tolist()) elif n.op_type == "ReduceL2": ret = inp[0].pow(2).sum(axis=opt['axes'], keepdim=opt['keepdims']).sqrt() + elif n.op_type == "ReduceSum": ret = inp[0].sum(axis=opt['axes'], keepdim=opt['keepdims']) elif n.op_type == "GlobalAveragePool": ret = inp[0].mean(axis=tuple(range(2, len(inp[0].shape))), keepdim=True) elif n.op_type == "Shape": ret = inp[0].shape elif n.op_type == "Expand": ret = inp[0].reshape([1]*(max(len(inp[0].shape), len(inp[1]))-len(inp[0].shape)) + list(inp[0].shape)) # just broadcast diff --git a/openpilot/manual_test.sh b/openpilot/manual_test.sh index f3dd4b612e..cc775d196c 100755 --- a/openpilot/manual_test.sh +++ b/openpilot/manual_test.sh @@ -1,4 +1,4 @@ #!/bin/bash -e -OPENCL=1 DEBUGCL=1 python3 openpilot/compile.py -#OPENCL=1 DEBUGCL=1 python3 openpilot/compile.py ../selfdrive/modeld/models/supercombo.onnx ../selfdrive/modeld/models/supercombo.thneed +#OPENCL=1 DEBUGCL=1 python3 openpilot/compile.py +OPENCL=1 DEBUGCL=1 python3 openpilot/compile.py ../selfdrive/modeld/models/supercombo.onnx ../selfdrive/modeld/models/supercombo.thneed #FLOAT32=1 python3 openpilot/run_thneed.py $PWD/../selfdrive/modeld/models/supercombo.thneed $PWD/../selfdrive/modeld/models/supercombo.onnx