MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / ShareBufferKernel

Function ShareBufferKernel

paddle/phi/kernels/share_buffer_kernel.cc:25–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23
24template <typename Context>
25void ShareBufferKernel(const Context &dev_ctx UNUSED,
26 const std::vector<const DenseTensor *> &x,
27 const std::vector<bool> &share_dims_and_dtype UNUSED,
28 std::vector<DenseTensor *> out,
29 std::vector<DenseTensor *> xout UNUSED) {
30 PADDLE_ENFORCE_EQ(
31 x.size(),
32 out.size(),
33 common::errors::PermissionDenied(
34 "The input(X) and Output(out) should have the same size, but got "
35 "size of Input(X) is %d and size of Output(out) is %d.",
36 x.size(),
37 out.size()));
38 for (size_t i = 0; i < x.size(); ++i) {
39 if (x[i] == nullptr || out[i] == nullptr) {
40 continue;
41 }
42 out[i]->ShareBufferWith(*x[i]);
43 VLOG(10) << "Share tensor buffer ";
44 }
45}
46
47} // namespace phi
48

Callers

nothing calls this directly

Calls 2

ShareBufferWithMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected