目录

GetPlacement

Function Description

Obtains the placement of a tensor, that is, the location of the device where the tensor data is located.

// Location of the device where the tensor data is located.
enum TensorPlacement {
  kOnDeviceHbm, //< The tensor is located in the HBM on the device.
  kOnHost, //< The tensor is located on the host.
  kFollowing, //< The tensor is located on the host, and the data follows the structure.
  kTensorPlacementEnd
};

Function Prototype

TensorPlacement GetPlacement() const

Parameters

None

Return Value

Tensor placement.

For details about the definition of the TensorPlacement type, see TensorPlacement.

Restrictions

None

Calling Example

std::vector<int> a = {10};
auto addr = reinterpret_cast<void *>(a.data());
TensorData td(addr, HostAddrManager, 100U, kOnHost);
auto td_place = td.GetPlacement(); // kOnHost