@@ -7,7 +7,7 @@ import {onnxruntime} from './ort-schema/ort-generated';
7
7
import ortFbs = onnxruntime . experimental . fbs ;
8
8
9
9
import { Tensor } from './tensor' ;
10
- import { LongUtil } from './util' ;
10
+ import { decodeUtf8String , LongUtil } from './util' ;
11
11
12
12
export declare namespace Attribute {
13
13
export interface DataTypeMap {
@@ -171,7 +171,7 @@ export class Attribute {
171
171
// string attributes are returned as string, so no conversion is needed.
172
172
if ( attr instanceof onnx . AttributeProto ) {
173
173
const utf8String = value as Uint8Array ;
174
- return Buffer . from ( utf8String . buffer , utf8String . byteOffset , utf8String . byteLength ) . toString ( ) ;
174
+ return decodeUtf8String ( utf8String ) ;
175
175
}
176
176
}
177
177
@@ -181,8 +181,7 @@ export class Attribute {
181
181
// format strings attributes are returned as string[], so no conversion is needed.
182
182
if ( attr instanceof onnx . AttributeProto ) {
183
183
const utf8Strings = value as Uint8Array [ ] ;
184
- return utf8Strings . map (
185
- utf8String => Buffer . from ( utf8String . buffer , utf8String . byteOffset , utf8String . byteLength ) . toString ( ) ) ;
184
+ return utf8Strings . map ( decodeUtf8String ) ;
186
185
}
187
186
}
188
187
0 commit comments