MutableTensorData
Description
Obtains data from a tensor.
Prototype
TensorData &MutableTensorData()
Parameters
None
Returns
Writable tensor data reference.
For details about the definition of the TensorData type, see TensorData.
Restrictions
None
Example
StorageShape sh({1, 2, 3}, {1, 2, 3});
Tensor t = {sh, {ge::FORMAT_ND, ge::FORMAT_FRACTAL_NZ, {}}, kOnHost, ge::DT_FLOAT, nullptr};
auto a = reinterpret_cast<void *>(10);
t.MutableTensorData() = TensorData{a, nullptr}; // Set new tensor data.
auto td = t.GetTensorData(); // TensorData{a, nullptr}
Parent topic: Tensor