From ce53cd103cc2ac09b43b4fdf586249e626bd5627 Mon Sep 17 00:00:00 2001 From: Grant Watson Date: Tue, 31 Oct 2023 19:02:14 +0000 Subject: Fix Reshape in operator API - The API incorrectly requires the new shape to be passed in twice. - This fix changes the name of the attribute from new_shape to shape in the generate_api.py script. - Adds a unit test to verify that the reshape operator works correctly. Signed-off-by: Grant Watson Change-Id: I07dd0ef786c747896b6e54f4eada0e7b97c6cef3 --- scripts/operator_api/generate_api.py | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) (limited to 'scripts') diff --git a/scripts/operator_api/generate_api.py b/scripts/operator_api/generate_api.py index afe12c1..99639f4 100644 --- a/scripts/operator_api/generate_api.py +++ b/scripts/operator_api/generate_api.py @@ -99,6 +99,9 @@ def getSerialLibAttsForOp(tosaOpName, allSerialLibAtts, tosaArgs): serLibOpAtts = copy.deepcopy(allSerialLibAtts[serLibOpType]) tosaArgsDict = {arg["name"]: arg for arg in tosaArgs} serTosaTypeMap = {"ResizeMode": "tosa_mode"} + # For reshape operator, change 'new_shape' to 'shape' to match tosa.xml + if tosaOpName == "reshape": + serLibOpAtts[0]["name"] = "shape" for att in serLibOpAtts: attName = att["name"] attType = att["dType"] @@ -397,33 +400,6 @@ def generate(environment, dataTypes, operators, base_path): renderTemplate(environment, dataTypes, operators, template, outfile) -def getSerializeOpTypeMap(): - """ - Utility function for generating the map used in getSerializeOpType() - """ - import re - - allSerialLibAtts = getSerialLibAtts() - serAtts = [ - re.sub(r"(?