peterjc123

Results 139 comments of peterjc123

这个后端不太熟悉,他是接受浮点的onnx模型吗?要不先参考这个脚本:https://github.com/alibaba/TinyNeuralNetwork/blob/main/examples/quantization/onnx_qat.py ?

Yes, looks like we will need to ignore this line during model conversion. https://github.com/alibaba/TinyNeuralNetwork/blob/main/tinynn/graph/quantization/modules.py#L124C32-L124C42

Well, we need to apply the same logic to `stack`.

@spacycoder What about this? ```py class CatModel(nn.Module): def forward(self, x: torch.Tensor): """ Args: x: [N, H, W, C] """ z = x.unsqueeze(-1) return torch.cat([-z, z], dim=-1) ```

Or this? ```py class CatModel(nn.Module): def forward(self, x: torch.Tensor): """ Args: x: [N, H, W, C] """ return torch.cat([-x, x], dim=-1).view(x.shape[:-1] + [-1, 2]) ```

@spacycoder It seems that the problem is on `mul_scalar`. The q-params for this op is calculated on the fly.

@spacycoder Things should work with https://github.com/alibaba/TinyNeuralNetwork/pull/360

> This also fails with the same concatenation error: > > ```python > import torch.nn as nn > import torch > from tinynn.graph.quantization.quantizer import PostQuantizer > from tinynn.converter import TFLiteConverter...

Related code snippet: https://github.com/alibaba/TinyNeuralNetwork/blob/main/tinynn/graph/quantization/quantizer.py#L1214C9-L1233