Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ICV-mmengine_basecode
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Florian Schiffel
ICV-mmengine_basecode
Commits
5170676a
Unverified
Commit
5170676a
authored
3 years ago
by
Haian Huang(深度眸)
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix mmdp unittest (#60)
parent
bc759e55
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_model/test_wrappers/test_data_parallel.py
+5
-4
5 additions, 4 deletions
tests/test_model/test_wrappers/test_data_parallel.py
with
5 additions
and
4 deletions
tests/test_model/test_wrappers/test_data_parallel.py
+
5
−
4
View file @
5170676a
# Copyright (c) OpenMMLab. All rights reserved.
# Copyright (c) OpenMMLab. All rights reserved.
from
unittest
import
TestCase
from
unittest.mock
import
MagicMock
,
patch
from
unittest.mock
import
MagicMock
,
patch
import
pytest
import
pytest
...
@@ -57,7 +58,7 @@ def test_is_model_wrapper():
...
@@ -57,7 +58,7 @@ def test_is_model_wrapper():
assert
is_model_wrapper
(
model_wrapper
)
assert
is_model_wrapper
(
model_wrapper
)
class
TestMMDataParallel
:
class
TestMMDataParallel
(
TestCase
)
:
def
setUp
(
self
):
def
setUp
(
self
):
"""
Setup the demo image in every test method.
"""
Setup the demo image in every test method.
...
@@ -70,7 +71,7 @@ class TestMMDataParallel:
...
@@ -70,7 +71,7 @@ class TestMMDataParallel:
def
__init__
(
self
):
def
__init__
(
self
):
super
().
__init__
()
super
().
__init__
()
self
.
conv
=
nn
.
Conv2d
(
2
,
2
,
1
)
self
.
conv
=
nn
.
Conv2d
(
1
,
2
,
1
)
def
forward
(
self
,
x
):
def
forward
(
self
,
x
):
return
self
.
conv
(
x
)
return
self
.
conv
(
x
)
...
@@ -101,7 +102,7 @@ class TestMMDataParallel:
...
@@ -101,7 +102,7 @@ class TestMMDataParallel:
with
pytest
.
raises
(
AssertionError
):
with
pytest
.
raises
(
AssertionError
):
mmdp
.
train_step
(
torch
.
zeros
([
1
,
1
,
3
,
3
]))
mmdp
.
train_step
(
torch
.
zeros
([
1
,
1
,
3
,
3
]))
out
=
self
.
model
.
train_step
(
[
torch
.
zeros
([
1
,
1
,
3
,
3
])
]
)
out
=
self
.
model
.
train_step
(
torch
.
zeros
([
1
,
1
,
3
,
3
]))
assert
out
.
shape
==
(
1
,
2
,
3
,
3
)
assert
out
.
shape
==
(
1
,
2
,
3
,
3
)
def
test_val_step
(
self
):
def
test_val_step
(
self
):
...
@@ -122,5 +123,5 @@ class TestMMDataParallel:
...
@@ -122,5 +123,5 @@ class TestMMDataParallel:
with
pytest
.
raises
(
AssertionError
):
with
pytest
.
raises
(
AssertionError
):
mmdp
.
val_step
(
torch
.
zeros
([
1
,
1
,
3
,
3
]))
mmdp
.
val_step
(
torch
.
zeros
([
1
,
1
,
3
,
3
]))
out
=
self
.
model
.
val_step
(
[
torch
.
zeros
([
1
,
1
,
3
,
3
])
]
)
out
=
self
.
model
.
val_step
(
torch
.
zeros
([
1
,
1
,
3
,
3
]))
assert
out
.
shape
==
(
1
,
2
,
3
,
3
)
assert
out
.
shape
==
(
1
,
2
,
3
,
3
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment