Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Fix toDictStringKey #99

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions react-native-pytorch-core/ios/ML/PTMIValue.mm
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ - (nullable PTMTensor*)toTensor {
if (_ivalue.isTensor() == NO) {
return nil;
}

at::Tensor tensor = _ivalue.toTensor();
return [PTMTensor fromTensor:tensor];
}
Expand All @@ -43,7 +43,7 @@ - (nullable NSString*)toString {
if (_ivalue.toString() == NO) {
return nil;
}

auto answer = _ivalue.toString();
return [NSString stringWithUTF8String:answer->string().c_str()];
}
Expand All @@ -52,10 +52,10 @@ - (nullable NSString*)toString {
if (_ivalue.isGenericDict() == NO) {
return nil;
}

auto dict = _ivalue.toGenericDict();
auto keyType = dict.keyType();
auto keyTypeKind = keyType->kind();
auto& keyType = dict.keyType()->expectRef<c10::DynamicType>();
auto keyTypeKind = keyType.dynamicKind();

if (keyTypeKind != c10::TypeKind::StringType) {
return nil;
Expand Down