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

Function SliceTensor

paddle/phi/kernels/funcs/broadcast_function.h:596–608  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

594}
595
596static void SliceTensor(DenseTensor *x,
597 const DenseTensor *share,
598 const std::vector<int64_t> &out_compute_dims,
599 int64_t offset) {
600 auto new_dim = make_ddim(out_compute_dims);
601 DenseTensorMeta meta(share->dtype(),
602 new_dim,
603 share->layout(),
604 offset * SizeOf(share->dtype()) + share->offset());
605 x->set_meta(meta);
606 x->ShareBufferWith(*(share), true);
607 x->Resize(new_dim);
608}
609
610template <typename OutT, typename Functor, int kArity, int NumOuts = 1>
611void BroadcastKernelSplit(const KPDevice &dev_ctx,

Callers 1

BroadcastKernelSplitFunction · 0.85

Calls 8

make_ddimFunction · 0.85
SizeOfFunction · 0.85
ShareBufferWithMethod · 0.80
dtypeMethod · 0.45
layoutMethod · 0.45
offsetMethod · 0.45
set_metaMethod · 0.45
ResizeMethod · 0.45

Tested by

no test coverage detected