Skip to content

Commit 0d450ae

Browse files
committed
post-rebase import conflicts
1 parent 05d71b5 commit 0d450ae

File tree

4 files changed

+15
-35
lines changed

4 files changed

+15
-35
lines changed

hls4ml/backends/fpga/fpga_backend.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,16 @@
3232
SeparableConv1D,
3333
SeparableConv2D,
3434
SimpleRNN,
35+
Softmax,
3536
)
3637
from hls4ml.model.optimizer import model_optimizer
3738
from hls4ml.model.types import (
3839
ExponentPrecisionType,
3940
FixedPrecisionType,
4041
IntegerPrecisionType,
4142
PrecisionType,
43+
RoundingMode,
44+
SaturationMode,
4245
UnspecifiedPrecisionType,
4346
XnorPrecisionType,
4447
)

hls4ml/converters/keras_v3/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def handle(
208208

209209

210210
@register
211-
class KV3NoOp(KerasV3LayerHandler):
211+
class NoOp(KerasV3LayerHandler):
212212
handles = (
213213
'keras.src.layers.preprocessing.image_preprocessing.random_brightness.RandomBrightness',
214214
'keras.src.layers.preprocessing.image_preprocessing.random_color_degeneration.RandomColorDegeneration',

hls4ml/converters/keras_v3/hgq2/_base.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
from collections.abc import Sequence
12
from math import prod
2-
from typing import TYPE_CHECKING, Any, Sequence
3+
from typing import TYPE_CHECKING, Any
34

45
import numpy as np
56

67
from hls4ml.converters.keras_v3._base import KerasV3LayerHandler, register
7-
from hls4ml.converters.keras_v3.conv import KV3ConvHandler
8-
from hls4ml.converters.keras_v3.core import KV3ActivationHandler, KV3DenseHandler, KV3MergeHandler
9-
from hls4ml.converters.keras_v3.einsum_dense import KV3EinsumDenseHandler
8+
from hls4ml.converters.keras_v3.conv import ConvHandler
9+
from hls4ml.converters.keras_v3.core import ActivationHandler, DenseHandler
10+
from hls4ml.converters.keras_v3.einsum_dense import EinsumDenseHandler
11+
from hls4ml.converters.keras_v3.merge import MergeHandler
1012

1113
if TYPE_CHECKING:
1214
import hgq
@@ -107,7 +109,7 @@ def load_weight(self, layer: 'Layer', key: str):
107109

108110

109111
@register
110-
class SQEinsumDenseHandler(SQLayerHandler, KV3EinsumDenseHandler):
112+
class SQEinsumDenseHandler(SQLayerHandler, EinsumDenseHandler):
111113
handles = (
112114
'hgq.layers.core.einsum_dense.QEinsumDense',
113115
'hgq.layers.einsum_dense_batchnorm.QEinsumDenseBatchnorm',
@@ -130,7 +132,7 @@ def handle(
130132

131133

132134
@register
133-
class SQConvHandler(SQLayerHandler, KV3ConvHandler):
135+
class SQConvHandler(SQLayerHandler, ConvHandler):
134136
handles = (
135137
'hgq.layers.conv.QConv1D',
136138
'hgq.layers.conv.QConv2D',
@@ -156,7 +158,7 @@ def handle(
156158

157159

158160
@register
159-
class SQDenseHandler(SQLayerHandler, KV3DenseHandler):
161+
class SQDenseHandler(SQLayerHandler, DenseHandler):
160162
handles = ('hgq.layers.core.dense.QDense', 'hgq.layers.core.dense.QBatchNormDense')
161163

162164
def handle(
@@ -175,7 +177,7 @@ def handle(
175177

176178

177179
@register
178-
class SQActivationHandler(SQLayerHandler, KV3ActivationHandler):
180+
class SQActivationHandler(SQLayerHandler, ActivationHandler):
179181
handles = ('hgq.layers.activation.QActivation',)
180182

181183

@@ -206,7 +208,7 @@ def handle(
206208

207209

208210
@register
209-
class SQMergeHandler(SQLayerHandler, KV3MergeHandler):
211+
class SQMergeHandler(SQLayerHandler, MergeHandler):
210212
handles = (
211213
'hgq.layers.ops.merge.QAdd',
212214
'hgq.layers.ops.merge.QSubtract',

hls4ml/model/layers.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import numpy as np
55

6-
from hls4ml.model import ModelGraph
76
from hls4ml.model.attributes import (
87
Attribute,
98
AttributeDict,
@@ -31,7 +30,6 @@
3130
find_minimum_width,
3231
)
3332
from hls4ml.utils import attribute_descriptions as descriptions
34-
from hls4ml.utils.einsum_utils import parse_einsum
3533
from hls4ml.utils.string_utils import convert_to_snake_case
3634

3735
if typing.TYPE_CHECKING:
@@ -1005,29 +1003,6 @@ def initialize(self):
10051003

10061004

10071005
class Softmax(Activation):
1008-
_expected_attributes = [
1009-
Attribute('n_in'),
1010-
Attribute('activation', value_type=str),
1011-
ChoiceAttribute('implementation', ['latency', 'stable', 'argmax', 'legacy'], default='stable'),
1012-
ConfigurableAttribute('skip', value_type=bool, default=False),
1013-
TypeAttribute(
1014-
'exp_table',
1015-
default=FixedPrecisionType(18, 8, rounding_mode=RoundingMode.RND, saturation_mode=SaturationMode.SAT),
1016-
),
1017-
TypeAttribute(
1018-
'inv_table',
1019-
default=FixedPrecisionType(18, 8, rounding_mode=RoundingMode.RND, saturation_mode=SaturationMode.SAT),
1020-
),
1021-
TypeAttribute(
1022-
'inv_inp',
1023-
default=FixedPrecisionType(18, 8, rounding_mode=RoundingMode.RND, saturation_mode=SaturationMode.SAT),
1024-
),
1025-
TypeAttribute(
1026-
'accum',
1027-
default=FixedPrecisionType(18, 8, rounding_mode=RoundingMode.RND, saturation_mode=SaturationMode.SAT),
1028-
),
1029-
]
1030-
10311006
def initialize(self):
10321007
super().initialize()
10331008

0 commit comments

Comments
 (0)