Commit acbadd10 authored by rusty1s's avatar rusty1s
Browse files

assertions

parent 74364643
...@@ -23,6 +23,8 @@ def _preprocess(position, size, batch=None, start=None): ...@@ -23,6 +23,8 @@ def _preprocess(position, size, batch=None, start=None):
min.append(position[:, i].min()) min.append(position[:, i].min())
position = position - position.new(min) position = position - position.new(min)
else: else:
assert start.numel() == size.numel(), (
'Start tensor must have same size as size tensor')
position = position - start.type_as(position) position = position - start.type_as(position)
# If given, append batch to position tensor. # If given, append batch to position tensor.
...@@ -49,6 +51,9 @@ def _fixed_cluster_size(position, size, batch=None, end=None): ...@@ -49,6 +51,9 @@ def _fixed_cluster_size(position, size, batch=None, end=None):
if end is None: if end is None:
return _minimal_cluster_size(position, size) return _minimal_cluster_size(position, size)
assert end.numel() == size.numel(), (
'End tensor must have same size as size tensor')
end = end.type_as(size) end = end.type_as(size)
eps = 0.000001 # Simulate [start, end) interval. eps = 0.000001 # Simulate [start, end) interval.
if batch is None: if batch is None:
......
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