Skip to content

Commit ff11281

Browse files
committed
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into fix_concat_check
2 parents 8274d9d + 0d779f1 commit ff11281

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

paddle/fluid/operators/math/sequence_padding.cu

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,6 @@ class PaddingLoDTensorFunctor<platform::CUDADeviceContext, T> {
7878
"The numel of 'pad_value' can only be 1 or be equal to the "
7979
"'step_width'.");
8080

81-
if (!norm_by_times && seq_num == 1UL && pad_seq_len == max_seq_len) {
82-
TensorCopy(seq_tensor, context.GetPlace(), context, pad_tensor);
83-
pad_tensor->Resize(pad_tensor_dims);
84-
return;
85-
}
86-
8781
const int kBlockSize = 512;
8882

8983
/* At least use 32 threads to copy sequence_width elements,
@@ -129,12 +123,13 @@ class UnpaddingLoDTensorFunctor<platform::CUDADeviceContext, T> {
129123

130124
CheckDims(seq_tensor_dims, pad_tensor_dims, seq_offsets, pad_seq_len,
131125
step_width, layout);
132-
126+
/*
133127
if (!norm_by_times && seq_num == 1UL && pad_seq_len == max_seq_len) {
134128
TensorCopy(pad_tensor, context.GetPlace(), context, seq_tensor);
135129
seq_tensor->Resize(seq_tensor_dims);
136130
return;
137131
}
132+
*/
138133

139134
const int kBlockSize = 512;
140135

paddle/fluid/operators/matmul_op.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,10 @@ class MatMulOp : public framework::OperatorWithKernel {
290290
context->Attrs().Get<bool>("transpose_Y"));
291291

292292
PADDLE_ENFORCE_EQ(mat_dim_x.width_, mat_dim_y.height_);
293-
PADDLE_ENFORCE(mat_dim_x.batch_size_ == mat_dim_y.batch_size_ ||
294-
mat_dim_x.batch_size_ == 0 || mat_dim_y.batch_size_ == 0);
293+
if (context->IsRuntime()) {
294+
PADDLE_ENFORCE(mat_dim_x.batch_size_ == mat_dim_y.batch_size_ ||
295+
mat_dim_x.batch_size_ == 0 || mat_dim_y.batch_size_ == 0);
296+
}
295297
std::vector<int64_t> dim_out;
296298
if (mat_dim_x.batch_size_ != 0) {
297299
dim_out = framework::vectorize(dim_x);

python/paddle/fluid/layers/nn.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4901,6 +4901,9 @@ def __check_input(x, y):
49014901

49024902
if len(y_shape) > 2 and len(x_shape) > 2:
49034903
for i, dim_x in enumerate(x_shape[:-2]):
4904+
# don't check neg shape
4905+
if dim_x < 0 or y_shape[i] < 0:
4906+
continue
49044907
if dim_x != y_shape[i]:
49054908
raise ValueError("Invalid inputs for matmul. x(%s), y(%s)" %
49064909
(x.shape, y.shape))

0 commit comments

Comments
 (0)