Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 24 additions & 10 deletions backends/arm/operators/op_avg_pool2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,12 @@ def define_node(
) -> None:
import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore

input_tensor = inputs[0]
assert input_tensor.dtype == ts.DType.INT8
supported_dtypes = [ts.DType.INT8]
if inputs[0].dtype not in supported_dtypes:
raise TypeError(
f"IO data type needs to be one of {supported_dtypes}, got "
f'"{inputs[0].dtype}"'
)

accumulator_type = ts.DType.INT32

Expand Down Expand Up @@ -118,9 +122,12 @@ def define_node(
) -> None:
import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore

assert (
inputs[0].dtype == ts.DType.INT8 or inputs[0].dtype == ts.DType.FP32
), "Only FP32 and INT8 supported"
supported_dtypes = [ts.DType.INT8, ts.DType.FP32]
if inputs[0].dtype not in supported_dtypes:
raise TypeError(
f"IO data type needs to be one of {supported_dtypes}, got "
f'"{inputs[0].dtype}"'
)

if inputs[0].dtype == ts.DType.INT8:
super().define_node(node, tosa_graph, inputs, output)
Expand Down Expand Up @@ -205,8 +212,12 @@ def define_node(
) -> None:
import serializer.tosa_serializer as ts # type: ignore

input_tensor = inputs[0]
assert input_tensor.dtype == ts.DType.INT8
supported_dtypes = [ts.DType.INT8]
if inputs[0].dtype not in supported_dtypes:
raise TypeError(
f"IO data type needs to be one of {supported_dtypes}, got "
f'"{inputs[0].dtype}"'
)

accumulator_type = ts.DType.INT32

Expand Down Expand Up @@ -241,9 +252,12 @@ def define_node(
) -> None:
import serializer.tosa_serializer as ts # type: ignore

assert (
inputs[0].dtype == ts.DType.INT8 or inputs[0].dtype == ts.DType.FP32
), "Only FP32 and INT8 supported"
supported_dtypes = [ts.DType.INT8, ts.DType.FP32]
if inputs[0].dtype not in supported_dtypes:
raise TypeError(
f"IO data type needs to be one of {supported_dtypes}, got "
f'"{inputs[0].dtype}"'
)

if inputs[0].dtype == ts.DType.INT8:
super().define_node(node, tosa_graph, inputs, output)
Expand Down
Loading