当前位置:网站首页>OSV-q The size of tensor a (3) must match the size of tensor b (320) at non-singleton dimension 3
OSV-q The size of tensor a (3) must match the size of tensor b (320) at non-singleton dimension 3
2022-07-28 22:44:00 【Claire_ Shang】
lap = -(cmul(fft2(grd_x), cconj(fft2(grd_x), inplace=False)) + cmul(fft2(grd_y), cconj(fft2(grd_y), inplace=False)))
File "C:/Users/shang/Desktop/STDN_LI/TVGnet/OSV_q.py", line 132, in cconj
c = t.clone() if not inplace else t
AttributeError: 'numpy.ndarray' object has no attribute 'clone'
hold ‘clone’ Change to ‘copy’ Unified type , Then I wrote new code
lap = -(conjoDx * otfDx + conjoDy * otfDy)
pdf1 = miu2 * (lap * fft2(f - output_net - b2)) - karma * (conjoDx * fft2(q1) + conjoDy * fft2(q2))There is a problem , The dimensions are not consistent ,
hold fft2 Each parameter dimension in has been changed to be consistent , Or an error
File "C:/Users/shang/Desktop/STDN_LI/TVGnet/OSV_q.py", line 391, in <module>
train(opt)
File "C:/Users/shang/Desktop/STDN_LI/TVGnet/OSV_q.py", line 320, in train
pdf1 = miu2 * (lap * fft2(f - output_net - b2)) - karma * (conjoDx * fft2(q1) + conjoDy * fft2(q2))
RuntimeError: The size of tensor a (3) must match the size of tensor b (320) at non-singleton dimension 3
Process finished with exit code 1
3.22 Because the code has been depressed for a long time , The school is still closed , In a very bad mood
I had a good look again today , Decide not to fool around anymore , Still have to find a way , You can't feel it , I finally found ,
Sure enough, calm down and you'll be fine . Carefully analyzed this error . It is found that several numerical dimensions in the error report do not match
b1 = {Tensor:(1,3,320,320)}
b2 = {Tensor:(1,3,320,320)}
f = {Tensor:(1,320,320,3)}
output_net = {Tensor:(1,3,320,320)} After so long, it turned out to be f Dimension problem of , I'm so angry , Do it !
because b1 b2 In the code is and f equal , So I just modified f The dimension of is good .
f = img_in.clone()
f = f.permute(2, 0, 1)
f = f.unsqueeze(0)There is no dimension error , But there are still errors in this line
====>> Sat Mar 12 11:01:15 2022 Pass time: 0:00:17.422007
Traceback (most recent call last):
File "C:/Users/shang/Desktop/STDN_LI/TVGnet/OSV_q.py", line 392, in <module>
train(opt)
File "C:/Users/shang/Desktop/STDN_LI/TVGnet/OSV_q.py", line 321, in train
pdf1 = miu2 * (lap * fftn(f - output_net - b2)) - karma * (conjoDx * fftn(q1) + conjoDy * fftn(q2))
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
Process finished with exit code 1changes
f = img_in.clone()
f = f.permute(2, 0, 1)
f = f.unsqueeze(0).type(torch.LongTensor).to(device)Not sure, right , But the problem has changed
====>> Sat Mar 12 11:45:10 2022 Pass time: 0:00:16.835837
Traceback (most recent call last):
File "C:/Users/shang/Desktop/STDN_LI/TVGnet/OSV_q.py", line 390, in <module>
train(opt)
File "C:/Users/shang/Desktop/STDN_LI/TVGnet/OSV_q.py", line 319, in train
pdf1 = miu2 * (lap * fftn(f - output_net - b2)) - karma * (conjoDx * fftn(q1) + conjoDy * fftn(q2))
ValueError: operands could not be broadcast together with shapes (348,348) (1,3,320,320)
Process finished with exit code 1
Error reporting here , I defined lap The value is (348,348), Should be tensor Broadcast error , Continue to study this problem
I found it
h, w, c = img_in.shape
nw, nh = w - w % d, h - h % d
# It turned out to be like this
otfDx = psf2otf(Dh_psf, [h, w])
otfDy = psf2otf(Dv_psf, [h, w])
# Change it to
otfDx = psf2otf(Dh_psf, [nh, nw])
otfDy = psf2otf(Dv_psf, [nh, nw])This line is finally correct
====>> Sat Mar 12 15:13:59 2022 Pass time: 0:00:17.143842
Traceback (most recent call last):
File "C:/Users/shang/Desktop/STDN_LI/TVGnet/OSV_q.py", line 390, in <module>
train(opt)
File "C:/Users/shang/Desktop/STDN_LI/TVGnet/OSV_q.py", line 322, in train
z = z.real.detach().clone()
AttributeError: 'numpy.ndarray' object has no attribute 'detach'
Process finished with exit code 1边栏推荐
- Kali source solution software cannot be installed correctly
- 770. Word replacement
- [connect set-top box] - use ADB command line to connect ec6108v9 Huawei Yuehe box wirelessly
- Concise history of graphic technology
- Redis related
- 775. 倒排单词
- 微信小程序使用canvas绘图,圆形头像,网络背景图,文字,虚线,直线
- How to use sprintf function
- Mysql8.0 cannot authorize users or prompt you are not allowed to create a user with grant
- c语言实现字符串逆序排列
猜你喜欢

Using PCL to batch display PCD point cloud data flow

MySQL installation and configuration (super detailed, simple and practical)
![[get mobile information] - get mobile information through ADB command](/img/ad/b10c5d09a21fb0cb22aa8a002fbd99.png)
[get mobile information] - get mobile information through ADB command
![[connect your mobile phone wirelessly] - debug your mobile device wirelessly via LAN](/img/7f/c49fd8c2cbe21585a080852833dcb4.png)
[connect your mobile phone wirelessly] - debug your mobile device wirelessly via LAN

STM32 board level support package for keys

Att & CK Threat Intelligence

Concise history of graphic technology
How do we do full link grayscale on the database?

842. Arrange numbers

6K6w5LiA5qyh5pS75Ye75YiG5p6Q
随机推荐
Ocr-gan [anomaly detection: Reconstruction Based]
STM32_ Hal library driven framework
C language to realize string reverse order arrangement
elment-plus图标input上面带的图标为什么不显示
LVS+KeepAlived高可用部署实战应用
B站713故障后的多活容灾建设|TakinTalks大咖分享
Summary of common error types in JS
Analysis notes on let (const) temporary dead zone in JS
Static details of static members
【转载】token令牌在登录场景使用
Use the picture name to label the picture [tips]
PC side web page effects (client series, scroll series, immediate function execution, sidebar effects)
删除容器镜像报错解决image is referenced in multiple repositories
mysql8.0无法给用户授权或提示You are not allowed to create a user with GRANT的问题
JVM——自定义类加载器
PaddleNLP基于ERNIR3.0文本分类:WOS数据集为例(层次分类)
105. Construct binary tree from preorder and inorder traversal sequence (medium binary tree DFS hash table binary tree)
Vscode ROS configuration GDB debugging error record
Draem+sspcab [anomaly detection: block]
JS implementation generates a random key of specified length