getTensorNames static method
Retrieves all tensor names currently allocated on the GPU. Allocates memory to store the String list natively and deletes it before returning its value,
Implementation
static List<String> getTensorNames() {
Pointer<Utf8> cStringPtr = _getTensorNames(handle);
if (cStringPtr == nullptr) {
return <String>[];
}
String combinedNames = cStringPtr.toDartString();
// _freeString remains manual because memory was allocated inside C++, not Dart.
_freeString(cStringPtr);
if (combinedNames.isEmpty) {
return <String>[];
}
List<String> rawNames = combinedNames.split(',');
List<String> cleanNames = <String>[];
for (int i = 0; i < rawNames.length; i = i + 1) {
cleanNames.add(rawNames[i].trim());
}
return cleanNames;
}