           dev_ctx.GetPlace(),
           workspace_size,
           phi::Stream(reinterpret_cast<phi::StreamId>(dev_ctx.stream())));
-      auto* dy_data = dev_ctx->Alloc<T>(dy, dy->numel() * sizeof(T));
+      auto* dy_data = dev_ctx.Alloc<T>(dy, dy->numel() * sizeof(T));
       const auto* dout_data = dout->data<T>();
       const auto* x_data = x->data<T>();
       const auto* a_data = kYGradAIsDZ ? dout_data : x_data;

             << " , activation = " << activation;
    bool enable_auxiliary = reserve_space == nullptr ? false : true;

    dev_ctx->Alloc<T>(out, out->numel() * sizeof(T));
    auto* out_data = out->data<T>();

    auto x_mat_dims =

          workspace_size,
          phi::Stream(reinterpret_cast<phi::StreamId>(dev_ctx.stream())));

      auto* dx_data = dev_ctx.Alloc<T>(dx, dx->numel() * sizeof(T));
      const auto* y_data = y->data<T>();
      const auto* dout_data = dout->data<T>();
      const auto* a_data = kXGradAIsDZ ? dout_data : y_data;
