diff --git a/paddle/fluid/operators/lstmp_op.h b/paddle/fluid/operators/lstmp_op.h index 9cad0bfd0427d77419557f4b79b11f4379befd6a..94040c59774b4091f97b974839cb7f12cf1cc863 100644 --- a/paddle/fluid/operators/lstmp_op.h +++ b/paddle/fluid/operators/lstmp_op.h @@ -94,25 +94,6 @@ class LSTMPKernel : public framework::OpKernel { PADDLE_THROW("unsupported activation type"); } - void Print(const Tensor& t, std::string name) const { - VLOG(1) << name << "size = " << t.numel(); - size_t size = t.numel(); - T* d = t.data(); -#ifdef PADDLE_WITH_CUDA - std::vector vec; - platform::DeviceContextPool::Instance().Get(t.place())->Wait(); - if (platform::is_gpu_place(t.place())) { - vec.resize(size); - cudaMemcpy(vec.data(), d, sizeof(T) * size, cudaMemcpyDeviceToHost); - d = vec.data(); - } -#endif - VLOG(1) << name << " data_ptr = " << static_cast(d); - for (size_t i = 0; i < size; i++) { - VLOG(1) << d[i] << ","; - } - } - void Compute(const framework::ExecutionContext& ctx) const override { auto* input = ctx.Input("Input"); auto* weight = ctx.Input("Weight"); diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index b5f6b5d4432097c22d71fc7640fd20150c74a071..c56fd1c9176147a843144850801710abf4d67ad5 100644 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -862,6 +862,11 @@ def dynamic_lstmp(input, 'The shape of c0 should be (batch_size, %d)' % size inputs['C0'] = c_0 + if cell_clip: + assert cell_clip >= 0, "cell_clip should not be negtive." + if proj_clip: + assert proj_clip >= 0, "proj_clip should not be negtive." + helper.append_op( type='lstmp', inputs=inputs,