MLBEDSW-7832: test_tflite_model_semantic converting array to scalar

 - The problem is that the axis value can be either a scalar or an
array containing a single element
 - The solution is to check the length of the shape because the size
attribute returns the same value for both cases
 - This did not show up before because pytest warnings were not being
treated as errors
 - Removed pre-commit pytest option that caused tests to be searched for
from the root directory
 - Updated pyproject.toml pytest options to explicitly specify the test
directories, and to treat warnings as errors

Change-Id: I037054768e5c34f253b6062eadba1c3419ff65e4
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 4f60e96..29f96d5 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -55,7 +55,7 @@
         name: pytest
         stages: [commit]
         language: system
-        entry: pytest -s -v .
+        entry: pytest -s -v
         types: [python]
         pass_filenames: false
         always_run: true
diff --git a/ethosu/vela/tflite_model_semantic.py b/ethosu/vela/tflite_model_semantic.py
index 24c0794..444c04a 100644
--- a/ethosu/vela/tflite_model_semantic.py
+++ b/ethosu/vela/tflite_model_semantic.py
@@ -436,7 +436,8 @@
         axis_tens = op.inputs[0]
         input_tens = op.inputs[1]
         dims = len(input_tens.shape)
-        axis = int(axis_tens.values)
+        # handle axis being a scalar or 1-D array
+        axis = int(axis_tens.values) if len(axis_tens.values.shape) == 0 else int(axis_tens.values[0])
         axis += dims if axis < 0 else 0
         valid = 0 <= axis < dims
         return valid, f"Op has ifm_dimensions={dims} and axis value is: {axis}"
@@ -448,7 +449,8 @@
         axis_tens = op.inputs[0]
         input_tens = op.inputs[1]
         dims = len(input_tens.shape)
-        axis = int(axis_tens.values)
+        # handle axis being a scalar or 1-D array
+        axis = int(axis_tens.values) if len(axis_tens.values.shape) == 0 else int(axis_tens.values[0])
         axis += dims if axis < 0 else 0
         valid = input_tens.shape[axis] % num_splits == 0
         return valid, f"Op has ifm shape={input_tens.shape} axis={axis} num_splits={num_splits}"
diff --git a/pyproject.toml b/pyproject.toml
index 2127d1a..f2c5d60 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -62,4 +62,11 @@
     "numpy; python_version>'3.7'",
     "setuptools_scm[toml]~=7.1.0"
 ]
-build-backend = "setuptools.build_meta"
\ No newline at end of file
+build-backend = "setuptools.build_meta"
+
+[tool.pytest.ini_options]
+minversion = "6.0"
+addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"]
+xfail_strict = true
+filterwarnings = ["error"]
+testpaths = ["ethosu/mlw_codec/test", "ethosu/vela/test"]
\ No newline at end of file