|
20 | 20 | SoftmaxCrossEntropyLossLayer, SoftmaxGradLayer, SoftmaxLayer, TransposeLayer, iHardswishLayer, iRMSNormLayer |
21 | 21 | from Deeploy.Targets.Generic.Parsers import AddParser, ConcatParser, DequantParser, FlattenParser, GatherParser, \ |
22 | 22 | GELUGradParser, GELUParser, GEMMParser, InPlaceAccumulatorV2Parser, LayerNormGradParser, LayerNormParser, \ |
23 | | - MatMulParser, MaxPool1DParser, MaxPool2DParser, MulParser, Pad1DParser, Pad2DParser, QuantParser, \ |
24 | | - ReduceSumParser, ReluParser, RequantShiftParser, ReshapeParser, RQAddParser, RQIntegerDivParser, RQSiGELUParser, \ |
| 23 | + MatMulParser, MaxPool1DParser, MaxPool2DParser, MulParser, Pad1DParser, Pad2DParser, QuantParser, ReduceSumParser, \ |
| 24 | + ReluParser, RequantShiftParser, ReshapeParser, RQAddParser, RQIntegerDivParser, RQSiGELUParser, \ |
25 | 25 | RQSiHardswishParser, SGDParser, SliceParser, SoftmaxCrossEntropyLossGradParser, SoftmaxCrossEntropyLossParser, \ |
26 | 26 | SoftmaxGradParser, SoftmaxParser, TransposeParser, UniformRequantShiftParser, UnsqueezeParser, iHardswishParser, \ |
27 | 27 | iRMSNormParser, iSoftmaxParser |
|
116 | 116 | DequantMapper = NodeMapper(DequantParser(), BasicDequantBindings) |
117 | 117 | GEMMDequantMapper = NodeMapper(PULPGEMMParser(), BasicGEMMBindings) |
118 | 118 | PULPMapping = { |
119 | | - 'Conv': ConvLayer([FPConv2DMapper, FPDWConv2DMapper]), |
120 | | - 'RequantizedConv': PULPRQSConvLayer([Conv2DMapper, DWConv2DMapper, Conv1DMapper, DWConv1DMapper]), |
121 | | - 'RequantizedGemm': PULPRQSGEMMLayer([MatrixVecMapper, TallGEMMMapper, GEMMMapper]), |
122 | | - 'Gemm': GEMMLayer([FloatGEMMMapper, GEMMDequantMapper]), |
123 | | - 'Gelu': GELULayer([GELUMapper]), |
124 | | - 'GeluGrad': GELUGradLayer([GELUGradMapper]), |
125 | | - 'LayerNormalization': LayerNormLayer([LayerNormMapper]), |
126 | | - 'LayerNormalizationGrad': LayerNormGradLayer([LayerNormGradMapper]), |
127 | | - 'MaxPool': MaxPoolLayer([MaxPool1DMapper, MaxPool2DMapper]), |
128 | | - 'RequantizediGELU': RQSiGELULayer([RQGELU_int8_Mapper]), |
129 | | - 'RQIntegerDiv': RQIntegerDivLayer([RQIntegerDivMapper]), |
130 | | - 'MatMul': MatMulLayer([MatMulMapper]), |
131 | | - 'IntegerMean': ReduceMeanLayer([ReduceMeanMapper]), |
132 | | - 'iSoftmax': SoftmaxLayer([Softmax_int8_Mapper]), |
133 | | - 'Softmax': SoftmaxLayer([SoftmaxMapper]), |
134 | | - 'ReduceMean': ReduceMeanLayer([ReduceMeanMapper]), |
135 | | - 'ReduceSum': ReduceSumLayer([ReduceSumMapper]), |
136 | | - 'RequantShift': RequantShiftLayer([UniformRequantShiftMapper, RequantShiftMapper]), |
137 | | - 'Add': AddLayer([AddMapper]), |
138 | | - 'Flatten': ReshapeLayer([FlattenMapper]), |
139 | | - 'Gather': GatherLayer([GatherMapper]), |
140 | | - 'Mul': MulLayer([MulMapper]), |
141 | | - 'Pad': PadLayer([Pad1DMapper, Pad2DMapper]), |
142 | | - 'Relu': ReluLayer([ReluMapper]), |
143 | | - 'Reshape': ReshapeLayer([ReshapeMapper]), |
144 | | - 'Squeeze': ReshapeLayer([UnsqueezeMapper]), |
145 | | - 'Transpose': TransposeLayer([TransposeMapper]), |
146 | | - 'Unsqueeze': ReshapeLayer([UnsqueezeMapper]), |
147 | | - 'Slice': SliceLayer([SliceMapper, DMASliceMapper]), |
148 | | - 'RequantizedAdd': AddLayer([RQAddMapper]), |
149 | | - 'Concat': ConcatLayer([ConcatMapper]), |
150 | | - 'iRMSNorm': iRMSNormLayer([iRMSNormMapper]), |
151 | | - 'iHardswish': iHardswishLayer([iHardswishMapper]), |
152 | | - 'RequantizediHardswish': RQSiHardswishLayer([RQSiHardswishMapper]), |
153 | | - 'Quant': QuantLayer([QuantMapper]), |
154 | | - 'Dequant': QuantLayer([DequantMapper]), |
155 | | - 'SoftmaxGrad': SoftmaxGradLayer([SoftmaxGradMapper]), |
| 119 | + 'Conv': |
| 120 | + ConvLayer([FPConv2DMapper, FPDWConv2DMapper]), |
| 121 | + 'RequantizedConv': |
| 122 | + PULPRQSConvLayer([Conv2DMapper, DWConv2DMapper, Conv1DMapper, DWConv1DMapper]), |
| 123 | + 'RequantizedGemm': |
| 124 | + PULPRQSGEMMLayer([MatrixVecMapper, TallGEMMMapper, GEMMMapper]), |
| 125 | + 'Gemm': |
| 126 | + GEMMLayer([FloatGEMMMapper, GEMMDequantMapper]), |
| 127 | + 'Gelu': |
| 128 | + GELULayer([GELUMapper]), |
| 129 | + 'GeluGrad': |
| 130 | + GELUGradLayer([GELUGradMapper]), |
| 131 | + 'LayerNormalization': |
| 132 | + LayerNormLayer([LayerNormMapper]), |
| 133 | + 'LayerNormalizationGrad': |
| 134 | + LayerNormGradLayer([LayerNormGradMapper]), |
| 135 | + 'MaxPool': |
| 136 | + MaxPoolLayer([MaxPool1DMapper, MaxPool2DMapper]), |
| 137 | + 'RequantizediGELU': |
| 138 | + RQSiGELULayer([RQGELU_int8_Mapper]), |
| 139 | + 'RQIntegerDiv': |
| 140 | + RQIntegerDivLayer([RQIntegerDivMapper]), |
| 141 | + 'MatMul': |
| 142 | + MatMulLayer([MatMulMapper]), |
| 143 | + 'IntegerMean': |
| 144 | + ReduceMeanLayer([ReduceMeanMapper]), |
| 145 | + 'iSoftmax': |
| 146 | + SoftmaxLayer([Softmax_int8_Mapper]), |
| 147 | + 'Softmax': |
| 148 | + SoftmaxLayer([SoftmaxMapper]), |
| 149 | + 'ReduceMean': |
| 150 | + ReduceMeanLayer([ReduceMeanMapper]), |
| 151 | + 'ReduceSum': |
| 152 | + ReduceSumLayer([ReduceSumMapper]), |
| 153 | + 'RequantShift': |
| 154 | + RequantShiftLayer([UniformRequantShiftMapper, RequantShiftMapper]), |
| 155 | + 'Add': |
| 156 | + AddLayer([AddMapper]), |
| 157 | + 'Flatten': |
| 158 | + ReshapeLayer([FlattenMapper]), |
| 159 | + 'Gather': |
| 160 | + GatherLayer([GatherMapper]), |
| 161 | + 'Mul': |
| 162 | + MulLayer([MulMapper]), |
| 163 | + 'Pad': |
| 164 | + PadLayer([Pad1DMapper, Pad2DMapper]), |
| 165 | + 'Relu': |
| 166 | + ReluLayer([ReluMapper]), |
| 167 | + 'Reshape': |
| 168 | + ReshapeLayer([ReshapeMapper]), |
| 169 | + 'Squeeze': |
| 170 | + ReshapeLayer([UnsqueezeMapper]), |
| 171 | + 'Transpose': |
| 172 | + TransposeLayer([TransposeMapper]), |
| 173 | + 'Unsqueeze': |
| 174 | + ReshapeLayer([UnsqueezeMapper]), |
| 175 | + 'Slice': |
| 176 | + SliceLayer([SliceMapper, DMASliceMapper]), |
| 177 | + 'RequantizedAdd': |
| 178 | + AddLayer([RQAddMapper]), |
| 179 | + 'Concat': |
| 180 | + ConcatLayer([ConcatMapper]), |
| 181 | + 'iRMSNorm': |
| 182 | + iRMSNormLayer([iRMSNormMapper]), |
| 183 | + 'iHardswish': |
| 184 | + iHardswishLayer([iHardswishMapper]), |
| 185 | + 'RequantizediHardswish': |
| 186 | + RQSiHardswishLayer([RQSiHardswishMapper]), |
| 187 | + 'Quant': |
| 188 | + QuantLayer([QuantMapper]), |
| 189 | + 'Dequant': |
| 190 | + QuantLayer([DequantMapper]), |
| 191 | + 'SoftmaxGrad': |
| 192 | + SoftmaxGradLayer([SoftmaxGradMapper]), |
156 | 193 | 'SoftmaxCrossEntropyLoss': |
157 | 194 | SoftmaxCrossEntropyLossLayer([SoftmaxCrossEntropyLossDualOutputMapper, SoftmaxCrossEntropyLossMapper]), |
158 | | - 'SoftmaxCrossEntropyLossGrad': SoftmaxCrossEntropyLossGradLayer([SoftmaxCrossEntropyLossGradMapper]), |
159 | | - 'SGD': SGDLayer([SGDMapper]), |
160 | | - 'InPlaceAccumulatorV2': InPlaceAccumulatorV2Layer([InPlaceAccumulatorV2Mapper]), |
| 195 | + 'SoftmaxCrossEntropyLossGrad': |
| 196 | + SoftmaxCrossEntropyLossGradLayer([SoftmaxCrossEntropyLossGradMapper]), |
| 197 | + 'SGD': |
| 198 | + SGDLayer([SGDMapper]), |
| 199 | + 'InPlaceAccumulatorV2': |
| 200 | + InPlaceAccumulatorV2Layer([InPlaceAccumulatorV2Mapper]), |
161 | 201 | } |
162 | 202 |
|
163 | 203 |
|
|
0 commit comments