Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
高校俱乐部
NodeJS_415251
提交
eeddf6a6
N
NodeJS_415251
项目概览
高校俱乐部
/
NodeJS_415251
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
NodeJS_415251
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
eeddf6a6
编写于
10月 24, 2023
作者:
C
csdnstudent
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Tue Oct 24 16:49:00 CST 2023 inscode
上级
d8c22349
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
53 addition
and
1 deletion
+53
-1
.inscode
.inscode
+5
-1
build/index.js
build/index.js
+48
-0
未找到文件。
.inscode
浏览文件 @
eeddf6a6
run = "npm i && npm run dev"
language = "node"
[env]
PATH = "/root/${PROJECT_DIR}/.config/npm/node_global/bin:/root/${PROJECT_DIR}/node_modules/.bin:${PATH}"
XDG_CONFIG_HOME = "/root/.config"
npm_config_prefix = "/root/${PROJECT_DIR}/.config/npm/node_global"
[debugger]
program = "main.js"
build/index.js
浏览文件 @
eeddf6a6
...
...
@@ -33,3 +33,51 @@ if (process.env.npm_config_preview || rawArgv.includes('--preview')) {
}
else
{
run
(
`vue-cli-service build
${
args
}
`
)
}
import
torch
import
torch
.
nn
as
nn
import
torch
.
nn
.
functional
as
F
from
torch
import
Tensor
class
CNN_Transformer
(
nn
.
Module
):
def
__init__
(
self
,
num_classes
):
super
(
CNN_Transformer
,
self
).
__init__
()
#
Define
CNN
layers
self
.
conv1
=
nn
.
Conv2d
(
3
,
32
,
kernel_size
=
3
,
stride
=
1
,
padding
=
1
)
self
.
conv2
=
nn
.
Conv2d
(
32
,
64
,
kernel_size
=
3
,
stride
=
1
,
padding
=
1
)
self
.
fc1
=
nn
.
Linear
(
64
*
16
*
16
,
128
)
#
Define
Transformer
layers
self
.
embedding
=
nn
.
Linear
(
128
,
512
)
self
.
layer_norm
=
nn
.
LayerNorm
(
512
)
self
.
self_attn
=
nn
.
MultiheadAttention
(
512
,
8
,
dropout
=
0.1
)
self
.
dropout1
=
nn
.
Dropout
(
0.1
)
self
.
linear1
=
nn
.
Linear
(
512
,
256
)
self
.
dropout2
=
nn
.
Dropout
(
0.5
)
self
.
linear2
=
nn
.
Linear
(
256
,
128
)
#
Define
output
layer
self
.
out
=
nn
.
Linear
(
128
,
num_classes
)
def
forward
(
self
,
x
:
Tensor
)
->
Tensor
:
#
Process
input
with
CNN
x
=
F
.
relu
(
self
.
conv1
(
x
))
x
=
F
.
relu
(
self
.
conv2
(
x
))
x
=
x
.
view
(
-
1
,
64
*
16
*
16
)
x
=
F
.
relu
(
self
.
fc1
(
x
))
#
Process
output
with
Transformer
x
=
self
.
embedding
(
x
)
x
=
self
.
layer_norm
(
x
.
permute
(
1
,
0
,
2
))
x
,
_
=
self
.
self_attn
(
x
,
x
,
x
)
x
=
self
.
dropout1
(
x
)
x
=
F
.
relu
(
self
.
linear1
(
x
))
x
=
self
.
dropout2
(
x
)
x
=
F
.
relu
(
self
.
linear2
(
x
))
#
Process
output
with
output
layer
x
=
self
.
out
(
x
)
return
x
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录