提交 5ae0c97f 编写于 作者: Y Yibing Liu

Add unit test case for no tokens to be erased

上级 d1d614b9
...@@ -44,5 +44,20 @@ class TestSequenceEraseOp(OpTest): ...@@ -44,5 +44,20 @@ class TestSequenceEraseOp(OpTest):
self.check_output() self.check_output()
class TestSequenceEraseOpEmpty(OpTest):
def setUp(self):
self.op_type = "sequence_erase"
in_seq = np.random.randint(0, 10, (30, 1)).astype("int32")
lod = [[0, 9, 13, 24, 30]]
tokens = []
out_seq, new_lod0 = sequence_erase(in_seq, lod[0], tokens)
self.attrs = {'tokens': tokens}
self.inputs = {'X': (in_seq, lod)}
self.outputs = {'Out': (out_seq, [new_lod0])}
def test_check_output(self):
self.check_output()
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册