专栏算法工具链atan2 算子不支持

atan2 算子不支持

已解决
默认473282025-11-26
21
4
在进行模型PTQ转换的时候出现如下报错
RuntimeError: Function on type <class 'torch.Tensor'> is not supported in hbir exporting,这个应该是atan2算子不支持,请问这个有什么方法能够解决?
算法工具链
征程6
评论1
0/1000
  • 默认47328
    Lv.1

    RuntimeError: Function on type is not supported in hbir exporting

    2025-11-26
    0
    3
    • Vincent回复默认47328:

      你好,这个原因是bpu中不支持torch.atan2算子转换, 这个算子是一个计算两个输入张量之间角度的函数 ,需要两个输入,如 torch.atan2(y, x) 。。。。。在bpu中torch.atan可以转换成 horizon.nn.Atan ,但是torch.atan是单输入,所以你可以将 torch.atan2 替换成torch.atan,单输入的这个你可以 你可以根据反正切的数学公式来修改 。即 torch.atan(y / x) ,但是要注意象限 。其影响正负。

      2025-11-26
      0
    • Vincent:

      y/x在forward里面可以手动计算之后 输入到torch.atan里面

      2025-11-26
      0
    • 默认47328回复Vincent:

      好的感谢解答,问题已解决!

      2025-11-27
      0