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
FAST-RNNT
Commits
6fbcae3e
Commit
6fbcae3e
authored
Jun 30, 2021
by
Daniel Povey
Browse files
Add test code
parent
b92c0456
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
torch_integrated_conv/integrated_conv_test.py
torch_integrated_conv/integrated_conv_test.py
+20
-0
No files found.
torch_integrated_conv/integrated_conv_test.py
0 → 100644
View file @
6fbcae3e
import
torch
from
torch_integrated_conv
import
integrated_conv
def
test_integrated_conv_zeros
():
N
=
1
C
=
2
H
=
3
W
=
4
for
device
in
[
torch
.
device
(
'cpu'
),
torch
.
device
(
'cuda:0'
)
]:
for
dtype
in
[
torch
.
float32
,
torch
.
float64
]:
print
(
"device="
,
device
,
", dtype="
,
dtype
)
input
=
torch
.
zeros
(
N
,
2
*
C
,
H
,
W
,
device
=
device
,
dtype
=
dtype
)
kH
=
5
kW
=
5
pos_add
=
torch
.
zeros
(
C
,
kH
,
kW
,
device
=
device
,
dtype
=
dtype
)
pos_mul
=
torch
.
zeros
(
C
,
kH
,
kW
,
device
=
device
,
dtype
=
dtype
)
output
=
integrated_conv
(
input
,
pos_add
,
pos_mul
)
assert
torch
.
allclose
(
input
,
output
)
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