MutableTensorData

Function Usage

Obtains the data of a tensor.

Prototype

1
TensorData &MutableTensorData()

Parameters

None

Returns

Writable tensor data reference.

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

Constraints

None

Examples

1
2
3
4
5
StorageShape sh({1, 2, 3}, {1, 2, 3});
TensorV2 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 addr = t.GetTensorData().GetAddr(); // 10