解决:TypeError: z_(): incompatible function arguments. The following argument types are supported

解决:TypeError: z_(): incompatible function arguments. The following argument types are supported





背景

在使用之前的代码通过Dlib进行人脸识别时,报错:
Traceback (most recent call last):
File “FaceRecognizeHaarCascade copy.py”, line 13, in
return g.op(‘plugin’, g, arg0, arg1, arg2)
TypeError: call(): incompatible function arguments. The following argument types are supported:
1. (self: _dlib_pybind11.fhog_object_detector, image: array, upsample_num_times: int=0) -> _dlib_pybind11.rectangles

Invoked with: <_dlib_pybind11.fhog_object_detector object at 0x000002428AC9B030>, None, 1



报错问题


Traceback (most recent call last):
  File "FaceRecognizeHaarCascade copy.py", line 13, in <module>
    return g.op('plugin', g, arg0, arg1, arg2)
TypeError: __call__(): incompatible function arguments. The following argument types are supported:
    1. (self: _dlib_pybind11.fhog_object_detector, image: array, upsample_num_times: int=0) -> _dlib_pybind11.rectangles

Invoked with: <_dlib_pybind11.fhog_object_detector object at 0x000002428AC9B030>, None, 1



报错翻译

主要报错信息内容翻译如下所示:


Traceback (most recent call last):
  File "FaceRecognizeHaarCascade copy.py", line 13, in <module>
    return g.op('plugin', g, arg0, arg1, arg2)
TypeError: __call__(): incompatible function arguments. The following argument types are supported:
    1. (self: _dlib_pybind11.fhog_object_detector, image: array, upsample_num_times: int=0) -> _dlib_pybind11.rectangles

Invoked with: <_dlib_pybind11.fhog_object_detector object at 0x000002428AC9B030>, None, 1

翻译:

回溯(最近一次调用最后一次):
  文件“FaceRecognizeHaarCascade copy.py”,第 13 行,在<module>
    return g.op('plugin', g, arg0, arg1, arg2)
TypeError:__call__():不兼容的函数参数。支持以下参数类型:
    1.(self:_dlib_pybind11.fhog_object_detector,image:array,upsample_num_times:int=0)-> _dlib_pybind11.rectangles

调用方式:<_dlib_pybind11.fhog_object_detector 对象位于 0x000002428AC9B030>、无、1


报错位置代码


	...
    return g.op('plugin', g, arg0, arg1, arg2)
	...
	


报错原因

经过查阅资料,发现是给的参数不是严格匹配函数需要的输入的,这种需要具体情况具体分析,但是主要办法就是好好检查自己的代码,函数输入哪里会存在不匹配的地方。

小伙伴们按下面的解决方法即可解决!!!



解决方法

要解决这个错误,需要检查自己的代码,更正函数输入参数里存在的不匹配的地方即可,如修改参数个数或者参数类型等不匹配。

以我下面的代码为例,注册 Pytorch plugin 算子时:

   //修改前
   def symbolic_plugin(g, arg0, arg1, arg2):
       return g.op('plugin', g, arg0, arg1, arg2)

上面的代码可能之前某些情况下确实可以正常运行,但是随着代码更新或者接口调用不同就会遇到上面的问题,主要是 g.op 函数的参数多了一个 g

   //修改后
   def symbolic_plugin(g, arg0, arg1, arg2):
       return g.op('plugin', arg0, arg1, arg2)


今天的分享就到此结束了

欢迎点赞评论关注三连

在这里插入图片描述

  • 9
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ninghes

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值