Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
stoneliu1981
pytorch-image-models
提交
715519a5
P
pytorch-image-models
项目概览
stoneliu1981
/
pytorch-image-models
与 Fork 源项目一致
从无法访问的项目Fork
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
pytorch-image-models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
715519a5
编写于
5月 06, 2021
作者:
R
Ross Wightman
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rethink name of patch embed grid info
上级
b2c305c2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
7 addition
and
7 deletion
+7
-7
timm/models/coat.py
timm/models/coat.py
+4
-4
timm/models/layers/patch_embed.py
timm/models/layers/patch_embed.py
+2
-2
timm/models/swin_transformer.py
timm/models/swin_transformer.py
+1
-1
未找到文件。
timm/models/coat.py
浏览文件 @
715519a5
...
...
@@ -490,7 +490,7 @@ class CoaT(nn.Module):
# Serial blocks 1.
x1
=
self
.
patch_embed1
(
x0
)
H1
,
W1
=
self
.
patch_embed1
.
out
_size
H1
,
W1
=
self
.
patch_embed1
.
grid
_size
x1
=
self
.
insert_cls
(
x1
,
self
.
cls_token1
)
for
blk
in
self
.
serial_blocks1
:
x1
=
blk
(
x1
,
size
=
(
H1
,
W1
))
...
...
@@ -499,7 +499,7 @@ class CoaT(nn.Module):
# Serial blocks 2.
x2
=
self
.
patch_embed2
(
x1_nocls
)
H2
,
W2
=
self
.
patch_embed2
.
out
_size
H2
,
W2
=
self
.
patch_embed2
.
grid
_size
x2
=
self
.
insert_cls
(
x2
,
self
.
cls_token2
)
for
blk
in
self
.
serial_blocks2
:
x2
=
blk
(
x2
,
size
=
(
H2
,
W2
))
...
...
@@ -508,7 +508,7 @@ class CoaT(nn.Module):
# Serial blocks 3.
x3
=
self
.
patch_embed3
(
x2_nocls
)
H3
,
W3
=
self
.
patch_embed3
.
out
_size
H3
,
W3
=
self
.
patch_embed3
.
grid
_size
x3
=
self
.
insert_cls
(
x3
,
self
.
cls_token3
)
for
blk
in
self
.
serial_blocks3
:
x3
=
blk
(
x3
,
size
=
(
H3
,
W3
))
...
...
@@ -517,7 +517,7 @@ class CoaT(nn.Module):
# Serial blocks 4.
x4
=
self
.
patch_embed4
(
x3_nocls
)
H4
,
W4
=
self
.
patch_embed4
.
out
_size
H4
,
W4
=
self
.
patch_embed4
.
grid
_size
x4
=
self
.
insert_cls
(
x4
,
self
.
cls_token4
)
for
blk
in
self
.
serial_blocks4
:
x4
=
blk
(
x4
,
size
=
(
H4
,
W4
))
...
...
timm/models/layers/patch_embed.py
浏览文件 @
715519a5
...
...
@@ -21,8 +21,8 @@ class PatchEmbed(nn.Module):
patch_size
=
to_2tuple
(
patch_size
)
self
.
img_size
=
img_size
self
.
patch_size
=
patch_size
self
.
out
_size
=
(
img_size
[
0
]
//
patch_size
[
0
],
img_size
[
1
]
//
patch_size
[
1
])
self
.
num_patches
=
self
.
out_size
[
0
]
*
self
.
out
_size
[
1
]
self
.
grid
_size
=
(
img_size
[
0
]
//
patch_size
[
0
],
img_size
[
1
]
//
patch_size
[
1
])
self
.
num_patches
=
self
.
grid_size
[
0
]
*
self
.
grid
_size
[
1
]
self
.
proj
=
nn
.
Conv2d
(
in_chans
,
embed_dim
,
kernel_size
=
patch_size
,
stride
=
patch_size
)
self
.
norm
=
norm_layer
(
embed_dim
)
if
norm_layer
else
nn
.
Identity
()
...
...
timm/models/swin_transformer.py
浏览文件 @
715519a5
...
...
@@ -467,7 +467,7 @@ class SwinTransformer(nn.Module):
img_size
=
img_size
,
patch_size
=
patch_size
,
in_chans
=
in_chans
,
embed_dim
=
embed_dim
,
norm_layer
=
norm_layer
if
self
.
patch_norm
else
None
)
num_patches
=
self
.
patch_embed
.
num_patches
self
.
patch_grid
=
self
.
patch_embed
.
out
_size
self
.
patch_grid
=
self
.
patch_embed
.
grid
_size
# absolute position embedding
if
self
.
ape
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录