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
970fac7c
Commit
970fac7c
authored
Aug 01, 2021
by
Daniel Povey
Browse files
Add assertions
parent
0f4e97aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
torch_mutual_information/mutual_information.py
torch_mutual_information/mutual_information.py
+6
-1
No files found.
torch_mutual_information/mutual_information.py
View file @
970fac7c
...
@@ -192,6 +192,11 @@ def mutual_information_recursion(px, py, boundary=None):
...
@@ -192,6 +192,11 @@ def mutual_information_recursion(px, py, boundary=None):
if
boundary
is
not
None
:
if
boundary
is
not
None
:
assert
boundary
.
dtype
==
torch
.
int64
assert
boundary
.
dtype
==
torch
.
int64
assert
boundary
.
shape
==
(
B
,
4
)
assert
boundary
.
shape
==
(
B
,
4
)
for
[
s_begin
,
t_begin
,
s_end
,
t_end
]
in
boundary
.
to
(
'cpu'
).
tolist
():
assert
0
<=
s_begin
<=
s_end
<=
S
assert
0
<=
t_begin
<=
t_end
<=
T
# The following assertions are for efficiency
assert
px
.
stride
()[
-
1
]
==
1
assert
py
.
stride
()[
-
1
]
==
1
return
MutualInformationRecursionFunction
.
apply
(
px
,
py
,
boundary
)
return
MutualInformationRecursionFunction
.
apply
(
px
,
py
,
boundary
)
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