TypeError: module() takes at most 2 arguments (3 given)
TypeError: module() takes at most 2 arguments (3 given)
这是我的报错代码
import os
import math
import paddle
import paddle.nn as nn
from .backbone import ResNetclass xxxx(nn.layer): # <------------------------- 这里报错def __init__(self,backbone_cfg=None,neck_cfg=None,head_cfg=None,loss_cfg=None,
如果你也是这样,在定义 class 的时候报了这个问题
那应该是和我一样的,代码中 nn.layer
是一个 module 而不是一个类的名字
打印一下:
>>> nn.layer
<module 'paddle.nn.layer' from 'xxxxxib/python3.7/site-packages/paddle/nn/layer/__init__.py'>
我是因为大小写的问题,把 nn.layer 改成 nn.Layer 就对了
>>> nn.Layer
<class 'paddle.fluid.dygraph.layers.Layer'>
有参考自:
https://stackoverflow.com/questions/14583761/typeerror-module-init-takes-at-most-2-arguments-3-given
TypeError: module() takes at most 2 arguments (3 given)相关推荐
- python:TypeError:takes at least 8 arguments (9 given)
1:背景 今天遇见一个问题,如标题所示,在python项目中,出现了TypeError:takes at least 8 arguments (9 given)的错误.首先,毋庸置疑的是,形参和实参不 ...
- scrapy shell 调试报错TypeError: module.__init__() takes at most 2 arguments (3 g iven)
1.使用scrapy shell的时候本人之前安装了ipython,使用shell调式格式从>>>变成了[1]这种带有ipython的格式,结果整齐度看起来比较舒服. 2.现在创建了 ...
- python创建对象后调用对象的方法,报错TypeError: getName() takes 0 positional arguments but 1 was given
源码 ## TODO: Create multiple cars and visualize them height = 4 width = 6 world = np.zeros((height, w ...
- MNE-Python : TypeError: today() takes no keyword arguments
运行代码 在使用MNE读取gdf文件时 import mne %matplotlib inline# Mention the file path to the dataset path = " ...
- TypeError: Person() takes no arguments
定义和使用python类定义的时候报错如题中的错误,具体代码如下: class Person:def _init_(self,name,age):self.name=nameself.age=agep ...
- 问题xxx: TypeError: __randomstate_ctor() takes from 0 to 1 positional arguments but 2 were given
背景是用了多台电脑跑模型,结果发现复制过来的MLP模型的*.pickle文件读不好(( 报错如下: bclf = pickle.load(f_bclf) TypeError: __randomstat ...
- 成功解决TypeError: fit_transform() takes 2 positional arguments but 3 were given
成功解决Traceback (most recent call last): File "F:\Program Files\Python\Python36\lib\site-packag ...
- Python使用字典get()方法TypeError: get() takes no keyword arguments
解决方法 dict的get("key", 0)方法不要添加default=,删除这个写法并不影响使用逻辑,但是加上会导致报错. d = {'key': 2, } print(d.g ...
- OpenCV——解决使用rectangle()函数时出现“TypeError: function takes exactly 4 arguments (2 given)”错误
1 问题描述 今天在使用cv.rectangle()函数时,出现了这样的报错: TypeError: function takes exactly 4 arguments (2 given) 源代码我 ...
最新文章
- 【C++】二叉树的先序、中序、后序遍历序列
- Linux下查找Nginx配置文件位置
- 一种实时轻量级3D人脸对齐方法
- TortoiseSVN在Windows下的使用
- Security Tutorials系列文章第七章:User-Based Authorization(下)
- 数据库设计三范式的举例及四大特性说明
- 开源监控软件 Hyperic 的两种插件
- javascript毫秒计时器_js实现精确到毫秒的倒计时效果
- 安装mysql不是Mariadb_解决centos7 中 使用mariadb 安装mysql不成功的问题
- 【离散数学】p^q^r为什么既是合取范式又是析取范式
- vue echarts饼状统计
- android引用aar中的字体,android.mk引用aar
- xp系统如何启用服务器服务,xp系统怎么样启用远程服务器
- 使用Pytorch搭建U-Net网络并基于DRIVE数据集训练(语义分割)学习笔记
- 吃大闸蟹 非得阳澄湖吗?
- html转图片/html2canvas的使用/星座测试/类似于损友圈的活动
- 十一、BDB ManyToMany
- http系列之-核心内容
- TIME_WAIT和CLOSE_WAIT状态区别
- Iperf 详细介绍