3
3
4
4
import { tensorToDataURL , tensorToImageData } from './tensor-conversion-impl.js' ;
5
5
import { TensorToDataUrlOptions , TensorToImageDataOptions } from './tensor-conversion.js' ;
6
- import { tensorFromGpuBuffer , tensorFromImage , tensorFromMlBuffer , tensorFromPinnedBuffer , tensorFromTexture } from './tensor-factory-impl.js' ;
7
- import { CpuPinnedConstructorParameters , GpuBufferConstructorParameters , MlBufferConstructorParameters , TensorFromGpuBufferOptions , TensorFromImageBitmapOptions , TensorFromImageDataOptions , TensorFromImageElementOptions , TensorFromTextureOptions , TensorFromUrlOptions , TextureConstructorParameters } from './tensor-factory.js' ;
6
+ import { tensorFromGpuBuffer , tensorFromImage , tensorFromMLBuffer , tensorFromPinnedBuffer , tensorFromTexture } from './tensor-factory-impl.js' ;
7
+ import { CpuPinnedConstructorParameters , GpuBufferConstructorParameters , MLBufferConstructorParameters , TensorFromGpuBufferOptions , TensorFromImageBitmapOptions , TensorFromImageDataOptions , TensorFromImageElementOptions , TensorFromTextureOptions , TensorFromUrlOptions , TextureConstructorParameters } from './tensor-factory.js' ;
8
8
import { checkTypedArray , NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP , NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP , SupportedTypedArray , SupportedTypedArrayConstructors } from './tensor-impl-type-mapping.js' ;
9
9
import { calculateSize , tensorReshape } from './tensor-utils-impl.js' ;
10
10
import { Tensor as TensorInterface } from './tensor.js' ;
@@ -16,7 +16,7 @@ type TensorDataType = TensorInterface.DataType;
16
16
type TensorDataLocation = TensorInterface . DataLocation ;
17
17
type TensorTextureType = TensorInterface . TextureType ;
18
18
type TensorGpuBufferType = TensorInterface . GpuBufferType ;
19
- type TensorMlBufferType = TensorInterface . MlBufferType ;
19
+ type TensorMLBufferType = TensorInterface . MLBufferType ;
20
20
21
21
/**
22
22
* the implementation of Tensor interface.
@@ -68,14 +68,14 @@ export class Tensor implements TensorInterface {
68
68
*
69
69
* @param params - Specify the parameters to construct the tensor.
70
70
*/
71
- constructor ( params : MlBufferConstructorParameters ) ;
71
+ constructor ( params : MLBufferConstructorParameters ) ;
72
72
73
73
/**
74
74
* implementation.
75
75
*/
76
76
constructor (
77
77
arg0 : TensorType | TensorDataType | readonly string [ ] | readonly boolean [ ] | CpuPinnedConstructorParameters |
78
- TextureConstructorParameters | GpuBufferConstructorParameters | MlBufferConstructorParameters ,
78
+ TextureConstructorParameters | GpuBufferConstructorParameters | MLBufferConstructorParameters ,
79
79
arg1 ?: TensorDataType | readonly number [ ] | readonly string [ ] | readonly boolean [ ] , arg2 ?: readonly number [ ] ) {
80
80
// perform one-time check for BigInt/Float16Array support
81
81
checkTypedArray ( ) ;
@@ -273,9 +273,9 @@ export class Tensor implements TensorInterface {
273
273
return tensorFromGpuBuffer ( gpuBuffer , options ) ;
274
274
}
275
275
276
- static fromMlBuffer < T extends TensorInterface . GpuBufferDataTypes > (
277
- mlBuffer : TensorMlBufferType , options : TensorFromGpuBufferOptions < T > ) : TensorInterface {
278
- return tensorFromMlBuffer ( mlBuffer , options ) ;
276
+ static fromMLBuffer < T extends TensorInterface . GpuBufferDataTypes > (
277
+ mlBuffer : TensorMLBufferType , options : TensorFromGpuBufferOptions < T > ) : TensorInterface {
278
+ return tensorFromMLBuffer ( mlBuffer , options ) ;
279
279
}
280
280
281
281
static fromPinnedBuffer < T extends TensorInterface . CpuPinnedDataTypes > (
@@ -326,7 +326,7 @@ export class Tensor implements TensorInterface {
326
326
/**
327
327
* stores the underlying WebNN MLBuffer when location is 'ml-buffer'. otherwise empty.
328
328
*/
329
- private mlBufferData ?: TensorMlBufferType ;
329
+ private mlBufferData ?: TensorMLBufferType ;
330
330
331
331
332
332
/**
@@ -376,7 +376,7 @@ export class Tensor implements TensorInterface {
376
376
return this . gpuBufferData ;
377
377
}
378
378
379
- get mlBuffer ( ) : TensorMlBufferType {
379
+ get mlBuffer ( ) : TensorMLBufferType {
380
380
this . ensureValid ( ) ;
381
381
if ( ! this . mlBufferData ) {
382
382
throw new Error ( 'The data is not stored as a WebNN buffer.' ) ;
0 commit comments