GetFormat

Description

Obtains the data layout format of a tensor during compilation.

Prototype

const StorageFormat &GetFormat() const

Parameters

None

Returns

Data layout format (StorageFormat), including the original format and storage format.

Restrictions

None

Example

StorageFormat storageFormat(ge::Format::FORMAT_NC, ge::FORMAT_NCHW, {});
gert::CompileTimeTensorDesc compileTimeTensorDesc;
compileTimeTensorDesc.SetStorageFormat(storageFormat.GetStorageFormat());
auto storage_fmt = compileTimeTensorDesc.GetFormat(); // ge::FORMAT_NCHW
compileTimeTensorDesc.SetOriginFormat(storageFormat.GetOriginFormat());
auto origin_fmt = compileTimeTensorDesc.GetOriginFormat(); // ge::Format::FORMAT_NC