Commit 970fac7c authored by Daniel Povey's avatar Daniel Povey
Browse files

Add assertions

parent 0f4e97aa
......@@ -192,6 +192,11 @@ def mutual_information_recursion(px, py, boundary=None):
if boundary is not None:
assert boundary.dtype == torch.int64
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)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment