Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ColossalAI
Commits
fb5bc6cb
Commit
fb5bc6cb
authored
May 16, 2022
by
LuGY
Committed by
binmakeswell
May 17, 2022
Browse files
[NFC] polish colossalai/nn/layer/parallel_3d/layers.py code style (#966)
parent
955463e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
colossalai/nn/layer/parallel_3d/layers.py
colossalai/nn/layer/parallel_3d/layers.py
+3
-3
No files found.
colossalai/nn/layer/parallel_3d/layers.py
View file @
fb5bc6cb
...
@@ -53,8 +53,8 @@ class LayerNorm3D(ParallelLayer):
...
@@ -53,8 +53,8 @@ class LayerNorm3D(ParallelLayer):
self
.
weight
=
Parameter
(
self
.
weight
=
Parameter
(
torch
.
ones
(
self
.
normalized_shape_per_partition
,
device
=
get_current_device
(),
dtype
=
dtype
))
torch
.
ones
(
self
.
normalized_shape_per_partition
,
device
=
get_current_device
(),
dtype
=
dtype
))
if
bias
:
if
bias
:
self
.
bias
=
Parameter
(
torch
.
zeros
(
self
.
normalized_shape_per_partition
,
self
.
bias
=
Parameter
(
device
=
get_current_device
(),
dtype
=
dtype
))
torch
.
zeros
(
self
.
normalized_shape_per_partition
,
device
=
get_current_device
(),
dtype
=
dtype
))
else
:
else
:
self
.
bias
=
None
self
.
bias
=
None
self
.
variance_epsilon
=
eps
self
.
variance_epsilon
=
eps
...
@@ -854,7 +854,7 @@ class PatchEmbedding3D(ParallelLayer):
...
@@ -854,7 +854,7 @@ class PatchEmbedding3D(ParallelLayer):
input_
=
split_tensor_3d
(
input_
,
0
,
self
.
input_parallel_mode
)
input_
=
split_tensor_3d
(
input_
,
0
,
self
.
input_parallel_mode
)
output
=
F
.
conv2d
(
input_
,
self
.
weight
,
self
.
bias
,
stride
=
self
.
patch_size
)
output
=
F
.
conv2d
(
input_
,
self
.
weight
,
self
.
bias
,
stride
=
self
.
patch_size
)
if
self
.
flatten
:
if
self
.
flatten
:
output
=
output
.
flatten
(
2
).
transpose
(
1
,
2
)
# BCHW -> BNC
output
=
output
.
flatten
(
2
).
transpose
(
1
,
2
)
# BCHW -> BNC
cls_token
=
self
.
cls_token
.
expand
(
output
.
shape
[
0
],
-
1
,
-
1
)
cls_token
=
self
.
cls_token
.
expand
(
output
.
shape
[
0
],
-
1
,
-
1
)
output
=
torch
.
cat
((
cls_token
,
output
),
dim
=
1
)
output
=
torch
.
cat
((
cls_token
,
output
),
dim
=
1
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment