| 23 | |
| 24 | template <typename Context> |
| 25 | void 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 |
nothing calls this directly
no test coverage detected