From 7ef2f2ddb6aea4ab931b2f5762579e419c78944c Mon Sep 17 00:00:00 2001 From: Minho Ryu Date: Thu, 4 Jul 2019 19:37:20 +0900 Subject: [PATCH] fix assertion for even number of batch size --- modeling.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modeling.py b/modeling.py index a7d719cfb..713be5637 100644 --- a/modeling.py +++ b/modeling.py @@ -233,7 +233,7 @@ def relative_positional_encoding(qlen, klen, d_model, clamp_len, attn_type, if bsz is not None: # With bi_data, the batch size should be divisible by 2. - assert bsz%2 == 0 + tf.debugging.assert_equal(bsz % 2, 0) fwd_pos_emb = positional_embedding(fwd_pos_seq, inv_freq, bsz//2) bwd_pos_emb = positional_embedding(bwd_pos_seq, inv_freq, bsz//2) else: