Skip to content

Commit 8c39b99

Browse files
author
fengshuai03
committed
use PADDLE_ENFORCE_GT to replace assert
1 parent dc979d0 commit 8c39b99

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

paddle/fluid/inference/tensorrt/plugin/qkv_to_context_plugin.cu

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,10 @@ __global__ void apply_scale(T *data, T scale, int n) {
234234
}
235235

236236
inline int round_up(int seq_len, int multiple = 32) {
237-
assert(multiple);
237+
PADDLE_ENFORCE_GT(
238+
multiple, 0,
239+
platform::errors::InvalidArgument(
240+
"multiple should be a positive number,but it's (%d)", multiple));
238241
return ((seq_len + multiple - 1) / multiple) * multiple;
239242
}
240243

paddle/fluid/operators/fused/multihead_matmul_op.cu

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,10 @@ void TransQKVWithBias(const int batch, const int seq_len, const int head_size,
133133
}
134134

135135
inline int round_up(int seq_len, int multiple = 32) {
136-
assert(multiple);
136+
PADDLE_ENFORCE_GT(
137+
multiple, 0,
138+
platform::errors::InvalidArgument(
139+
"multiple should be a positive number,but it's (%d)", multiple));
137140
return ((seq_len + multiple - 1) / multiple) * multiple;
138141
}
139142

0 commit comments

Comments
 (0)