添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
想发财的苹果  ·  Spring ...·  7 月前    · 
拉风的包子  ·  dataframe python ...·  1 年前    · 
豪爽的手套  ·  Django runserver内存泄漏?·  1 年前    · 

在自编码器中,进行上池化操作时报了forward() missing 1 required positional argument: 'indices’的错误。
部分代码:

def __init__():
	self.pool1 = nn.MaxPool2d((3,3),stride=2)
	self.pool2 = nn.MaxUnpool2d((3,3),stride=2)
、、、、、
def forward():
	tempx= self.pool1(x)
	y = self.pool2(tempx)

uppool需要将池化返回索引作为位置参数,这些索引将与 return_indices=True 一起返回。
修改为:

def __init__():
	self.pool1 = nn.MaxPool2d((3,3),stride=2,return_indices=True )
	self.pool2 = nn.MaxUnpool2d((3,3),stride=2)
、、、、、
def forward():
	tempx,indices= self.pool1(x)
	y = self.pool2(tempx,indices)
                    在自编码器中,进行上池化操作时报了forward() missing 1 required positional argument: 'indices’的错误。部分代码:def __init__():	self.pool1 = nn.MaxPool2d((3,3),stride=2)	self.pool2 = nn.MaxUnpool2d((3,3),stride=2)、、、、、def forward():	tempx= self.pool1(x)	y = self.pool2(tempx)
				
运行pytorch代码 train.py,特别是在用多个GPU并行运行的情况下,有时会出现这种警报: TypeError: forward() missing 4 required positional arguments: 'label', 'inst', 'image', and 'feat' 产生错误的原因是读取数据时丢失了其中几项。为什么会丢失输入项呢,是因为 batchsize 的...
TypeError: forward() missing 1 required positional argument: ‘x’ #1074 在yolov4 pytorch训练时遇到此错误 解决方法: 测试集的数据量要能被BatchSize整除,简单方法是直接删除valid.txt里的标签路径。 转载请注明出处,谢谢 TypeError: Caught TypeError in replica 1 on device 1. TypeError: forward() missing 1 required positional argument: 'x' 百度了一下发现是因为我使用了多个显卡,导致在inference阶段,模型和数据不在同一个显卡上,所以后面同时报了: TypeError: forward() missing 1 re...
pytorch 出现forward() missing 1 required positional argument: 'input’的可能原因 ----> 6 out = model(img_feature, assistant_feature) ~/.local/lib/python3.7/site-packages/torch/nn/modules/module.py in...
这个错误是 def forward(self, x)函数缩进问题。 2.forward() missing 1 required positional argument: 'input’ relu 函数没有加参数x
File ".\seg_v2\framework.py", line 13, in __init__ self.net = net().cuda() File "C:\Users\Administrator\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 722, in _call_impl result = self.forward(*input, **kwargs) TypeError: forward()
PyTorch跑旧模型代码时候报错: RuntimeError: Legacy autograd function with non-static forward method is deprecated. Please use new-style autograd function with static forward method. (Example: https://pytorch.org/docs/stable/autograd.html#torch.autograd.Function)
This error message indicates that the function `forward()` requires an argument called `indices` that was not provided when the function was called. To fix this error, you need to pass the required argument `indices` to the `forward()` function when you call it. You should check the documentation for the function to see what kind of data type the `indices` argument should be and make sure that you pass in the correct type of data. For example, if the `indices` argument is supposed to be a list of integers, you might call the function like this: my_model.forward(indices=[0, 1, 2]) Alternatively, you might need to modify the function definition to make the `indices` argument optional or provide a default value.
基于SpringBoot的酒店订房系统+82159(免费领源码)可做计算机毕业设计JAVA、PHP、爬虫、APP、小程序、C#、C++、python、数据可视化、大数据、全套文案