use i&i-1 to judge if it is a power of 2
This commit is contained in:
parent
2057124004
commit
e3e8b1990c
@ -1252,8 +1252,8 @@ class EmformerEncoder(nn.Module):
|
|||||||
):
|
):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
assert int(math.log(chunk_length, 2)) == math.log(
|
assert (
|
||||||
chunk_length, 2
|
chunk_length - 1 & chunk_length == 0
|
||||||
), "chunk_length should be a power of 2."
|
), "chunk_length should be a power of 2."
|
||||||
|
|
||||||
self.use_memory = memory_size > 0
|
self.use_memory = memory_size > 0
|
||||||
|
|||||||
@ -1188,8 +1188,8 @@ class EmformerEncoder(nn.Module):
|
|||||||
):
|
):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
assert int(math.log(chunk_length, 2)) == math.log(
|
assert (
|
||||||
chunk_length, 2
|
chunk_length - 1 & chunk_length == 0
|
||||||
), "chunk_length should be a power of 2."
|
), "chunk_length should be a power of 2."
|
||||||
|
|
||||||
self.use_memory = memory_size > 0
|
self.use_memory = memory_size > 0
|
||||||
|
|||||||
Reference in New Issue
Block a user