当前位置:网站首页>Initialization layer implementation
Initialization layer implementation
2022-06-23 07:11:00 【Houston pineapple】
application :
Do not change the original image after convolution (H,W)
function :
1. Set up location
2. Set the specified value
3. Set up padding
Realization :
#Refer to the official website
import paddle.fluid as fluid
from paddle.fluid.dygraph import Conv2D
from paddle.fluid.initializer import NumpyArrayInitializer
import numpy as np
np.set_printoptions(precision=1)
def main():
x = np.random.rand(6,6).astype(np.float32)
print(x.shape)
print(x)
x = x[np.newaxis,np.newaxis,:,:]
d = 2
with fluid.dygraph.guard(fluid.CPUPlace()):
w = np.ones((1,1,3,3)).astype(np.float32)
pa = fluid.ParamAttr(name = 'conv',initializer=NumpyArrayInitializer(w))
dilated_conv = Conv2D(num_channels=1,
num_filters=1,
filter_size=3,
dilation=d,
padding=0,
stride=1,
param_attr=pa)
print(dilated_conv.weight.numpy().squeeze((0,1)))
print(f'dilation={d}')
x = fluid.dygraph.to_variable(x)
y = dilated_conv(x)
y = y.numpy().squeeze((0,1))
print(y.shape)
print(y)
function :

边栏推荐
- [system] right click the desktop icon. After turning around, the Explorer will crash and the desktop will be refreshed
- 303. 区域和检索 - 数组不可变
- About Supervision
- 宝塔忘记密码
- Endnote20 tutorial sharing (unfinished
- 406 double pointer (27. remove elements, 977. square of ordered array, 15. sum of three numbers, 18. sum of four numbers)
- 316. 去除重复字母
- [STL] summary of stack and queue usage of container adapter
- 306. 累加数
- XML DTD record
猜你喜欢

【***数组***】

MySQL重做日志 redo log

Open source oauth2 framework for SSO single sign on

Regular expression graph and text ultra detailed summary without rote memorization (Part 1)

为什么TCP协议是三次握手而不是两次?

云原生落地进入深水区,博云容器云产品族释放四大价值

正则表达式图文超详细总结不用死记硬背(上篇)
![Don't look for [12 super easy-to-use Google plug-ins are here] (are you sure you want to take a look?)](/img/45/3e43faf7aba6741825ccb9719b8445.png)
Don't look for [12 super easy-to-use Google plug-ins are here] (are you sure you want to take a look?)

Solve the mining virus sshd2 (redis does not set a password and clear the crontab scheduled task)

Some difficulties in making web pages
随机推荐
[shell] tree command
Using fuser to view file usage
为什么TCP协议是三次握手而不是两次?
Open source oauth2 framework for SSO single sign on
System permission program cannot access SD card
896. monotonic sequence
MySQL index
Vs2013 ffmpeg environment configuration and common error handling
[system] right click the desktop icon. After turning around, the Explorer will crash and the desktop will be refreshed
About SQL: is there a way to fill in the null value in the field without adding fields on the basis of the original fields
313. 超级丑数
deeplab v3 代码结构图
[STL] summary of stack and queue usage of container adapter
[project training] multi segment line expanded to parallel line
Advanced drawing skills of Excel lecture 100 (VIII) -excel drawing WiFi diagram
[daily training] 513 Find the value in the lower left corner of the tree
313. super ugly number
GloRe
322. change exchange
【STL】关联容器之unordered_map用法总结