当前位置:网站首页>OSV_ Q write divergence operator div and Laplace stepped on the pit
OSV_ Q write divergence operator div and Laplace stepped on the pit
2022-07-28 22:44:00 【Claire_ Shang】
In order to write the image matrix of Laplace , You need to use the divergence operator
Start copying other people's code
def divergence(x, y):
divx = x - np.roll(x, 1, axis=1)
divy = y - np.roll(y, 1, axis=-1)
div = divx + divy
return div
Report errors : Because it's not supported Tensor and list Division operation of type # loss1 = miu2 * mse(u1, f1 - dive + b2) # Because it's not supported Tensor and list Division operation of type # loss1 = torch.optim.Adam(f1 - dive + b2, lr=0.1) # l2 Regularization
Report errors : Because it's not supported Tensor and Add Division operation of type
Write Laplace in the most primitive way
zxx, zxy = getGrd(zx) zyx, zyy = getGrd(zy) dive = zxx + zyy
.......
Although there are other new mistakes , To move forward
Report errors :
dive1 = zxx + zyy
RuntimeError: The size of tensor a (320) must match the size of tensor b (318) at non-singleton dimension 3
Maybe I did two gradients , Dimensions are inconsistent , Choose to zero the boundary of the gradient :
def getGrd(data_in):
# [m, n] = data_in.shape
# data_in1 = torch.Tensor(np.pad(data_in, ((0, 0), (0, 0), (0, 0), (0, 0)), 'edge'))
grd_x = data_in.clone()
grd_y = data_in.clone()
grd_x = grd_x[:, :, 0:-1, :] - data_in[:, :, 1:, :]
# grd_x = torch.Tensor(np.pad(grd_x, ((0, 0), (0, 0), (0, 1), (0, 0)), "constant")) # Zero compensation
grd_y = grd_y[:, :, :, 0:-1] - data_in[:, :, :, 1:]
# grd_y = torch.Tensor(np.pad(grd_y, ((0, 0), (0, 0), (0, 0), (0, 1)), "constant"))
# Zero compensation
grd = (grd_x, grd_y)
return grd边栏推荐
- Paddlenlp text classification based on ernir3.0: take wos dataset as an example (hierarchical classification)
- 容器化配置启动redis集群 单机6节点 3主3从
- PUA in the workplace, but it makes sense
- Memseg [anomaly detection: embedded based]
- Imx6q GPIO multiplexing
- STM32 - interrupt overview (interrupt priority)
- 微信小程序剪切图片的功能
- Common library code snippet pytorch_ based【tips】
- Anomaly detection summary: intensity_ based/Normalizing Flow
- 《结构学》介绍
猜你喜欢

Anomaly detection summary: intensity_ based/Normalizing Flow
![Labelme labels circular objects [tips]](/img/da/5790d814168b23321ab00a1d17189f.png)
Labelme labels circular objects [tips]
![Padim [anomaly detection: embedded based]](/img/11/834d8b4fdd39959a9dd380e179d317.png)
Padim [anomaly detection: embedded based]

Lvs+keepalived high availability deployment practical application

STM32 board level support package for keys

imx6q gpio复用

STM32 - external interrupt application (exti) (use cubemx to configure interrupts)

STM32 -- program startup process

The blueprint of flask complements openpyxl
![MKD [anomaly detection: knowledge disruption]](/img/15/10f5c8d6851e94dac764517c488dbc.png)
MKD [anomaly detection: knowledge disruption]
随机推荐
JS implementation generates a random key of specified length
ssh免密登陆
ATT&CK初步了解
STM32 - Communication
The function of wechat applet to cut pictures
Soft exam network engineer
Common library code snippet pytorch_ based【tips】
What to do after mathematical modeling gets the competition problem and some ("crooked ways") tips - must see before the competition
How to install and use PHP library neo4j
Padim [anomaly detection: embedded based]
Excel-vba quick start (XIII. Common usage of date)
JS get the current time (year month day hour minute second)
98. Verify binary search tree (medium binary search tree DFS)
Stm32subeide (10) -- ADC scans multiple channels in DMA mode
删除容器镜像报错解决image is referenced in multiple repositories
ngx+sql环境离线安装日志(rpm安装)
mysql8.0无法给用户授权或提示You are not allowed to create a user with GRANT的问题
79. Word search (medium string array matrix backtracking)
近期bug总结
STM32 - DMA direct memory access controller (cubemx configures DMA)