From d44304885f4dbdbcde3236c9218451b10540bf87 Mon Sep 17 00:00:00 2001 From: ajaybati Date: Sun, 27 Aug 2023 18:41:04 -0400 Subject: [PATCH] fixing test case; linux tested script, works --- examples/{run_basic_mac.sh => run_basic_maclinux.sh} | 4 ++-- fLibrary/Makefile | 8 -------- fLibrary/modelParserONNX.py | 7 ++++--- 3 files changed, 6 insertions(+), 13 deletions(-) rename examples/{run_basic_mac.sh => run_basic_maclinux.sh} (85%) diff --git a/examples/run_basic_mac.sh b/examples/run_basic_maclinux.sh similarity index 85% rename from examples/run_basic_mac.sh rename to examples/run_basic_maclinux.sh index aef5146..1d58cf4 100755 --- a/examples/run_basic_mac.sh +++ b/examples/run_basic_maclinux.sh @@ -9,8 +9,8 @@ make library #compile "source files" (capiTester.f90), link to the library file created, and run gfortran -c ../examples/capiTester.f90 -IobjFiles/ -gfortran -o flibrary libcorelib.a capiTester.o +gfortran -o flibrary capiTester.o libcorelib.a ./flibrary #check whether python output from PyTorch model = roseNNa's output -python3 ../test/testChecker.py gemm_small \ No newline at end of file +python3 ../test/testChecker.py gemm_small diff --git a/fLibrary/Makefile b/fLibrary/Makefile index 0753fb9..bc9794f 100644 --- a/fLibrary/Makefile +++ b/fLibrary/Makefile @@ -15,14 +15,6 @@ output: $(COMP) $(OBJ2) %.o: %.f90 $(FC) $(FFLAGS) -c $< -o $@ - -#preprocess: modelParserONNX.py - # arg1 = model structure file (.onnx format) - # arg2 (optional) = weights file (.onnx format) - #python3 modelParserONNX.py -f $(args) - - #for *.mod and *.o files - library: output mkdir -p objFiles ar crv libcorelib.a $(COMP) $(OBJ2) diff --git a/fLibrary/modelParserONNX.py b/fLibrary/modelParserONNX.py index de37e84..e90e162 100644 --- a/fLibrary/modelParserONNX.py +++ b/fLibrary/modelParserONNX.py @@ -431,9 +431,10 @@ def spreadInfo(trueShape, toBeTransformedShape): names = {n.name:n.i if n.type==2 else n.ints for n in node.attribute} attributes = [names.get('ceil_mode', 0), names.get('pads', [0,0,0,0]), - names.get('strides', [1,1])] - modelArch.append(("AveragePool", [ioMap[node.input[0]]], attributes)) #(ceil_mode, pads, strides) - f.write(str(node.attribute[1].ints[0])) + names.get('strides', [1,1]), + names.get('kernel_shape', 0)] + modelArch.append(("AveragePool", [ioMap[node.input[0]]], attributes[:3])) #(ceil_mode, pads, strides) + f.write(str(attributes[-1][0])) f.write("\n") ioMap[node.output[0]] = ioMap[node.input[0]]