From be330842a996f73bee8d554e2eaeb76c14cf5c06 Mon Sep 17 00:00:00 2001 From: Wanming Lin Date: Thu, 14 Nov 2024 08:24:10 +0800 Subject: [PATCH] Remove MLTensorUsage --- code/.eslintrc.js | 1 - code/samples/matmul.js | 3 --- code/samples/mul_add.js | 2 -- code/samples/simple_graph.js | 2 -- face_recognition/.eslintrc.js | 1 - face_recognition/facenet_nchw.js | 2 -- face_recognition/facenet_nhwc.js | 2 -- facial_landmark_detection/.eslintrc.js | 1 - facial_landmark_detection/face_landmark_nchw.js | 2 -- facial_landmark_detection/face_landmark_nhwc.js | 2 -- facial_landmark_detection/ssd_mobilenetv2_face_nchw.js | 2 -- facial_landmark_detection/ssd_mobilenetv2_face_nhwc.js | 2 -- image_classification/.eslintrc.js | 1 - image_classification/efficientnet_fp16_nchw.js | 2 -- image_classification/mobilenet_nchw.js | 2 -- image_classification/mobilenet_nhwc.js | 2 -- image_classification/resnet50v1_fp16_nchw.js | 2 -- image_classification/resnet50v2_nchw.js | 2 -- image_classification/resnet50v2_nhwc.js | 2 -- image_classification/squeezenet_nchw.js | 2 -- image_classification/squeezenet_nhwc.js | 2 -- lenet/.eslintrc.cjs | 1 - lenet/lenet.js | 2 -- nnotepad/.eslintrc.js | 1 - nnotepad/js/nnotepad.js | 3 +-- nsnet2/.eslintrc.js | 1 - nsnet2/nsnet2.js | 4 ---- object_detection/.eslintrc.js | 1 - object_detection/ssd_mobilenetv1_nchw.js | 3 --- object_detection/ssd_mobilenetv1_nhwc.js | 3 --- object_detection/tiny_yolov2_nchw.js | 2 -- object_detection/tiny_yolov2_nhwc.js | 2 -- rnnoise/.eslintrc.js | 1 - rnnoise/rnnoise.js | 8 -------- semantic_segmentation/.eslintrc.js | 1 - semantic_segmentation/deeplabv3_mnv2_nchw.js | 2 -- semantic_segmentation/deeplabv3_mnv2_nhwc.js | 2 -- style_transfer/.eslintrc.js | 1 - style_transfer/fast_style_transfer_net.js | 2 -- 39 files changed, 1 insertion(+), 78 deletions(-) diff --git a/code/.eslintrc.js b/code/.eslintrc.js index 1ddccda7..3e20ef05 100644 --- a/code/.eslintrc.js +++ b/code/.eslintrc.js @@ -3,7 +3,6 @@ module.exports = { 'CodeMirror': 'readonly', 'executeCodeSnippet': 'readonly', 'sizeOfShape': 'readonly', - 'MLTensorUsage': 'readonly', }, ignorePatterns: ['libs/'], }; diff --git a/code/samples/matmul.js b/code/samples/matmul.js index 43eb93fd..364207d5 100644 --- a/code/samples/matmul.js +++ b/code/samples/matmul.js @@ -12,9 +12,7 @@ const graph = await builder.build({c}); // Step 3: Bind input and output buffers to the graph and execute. const bufferA = new Float32Array(3*4).fill(1.0); const bufferB = new Float32Array(4*3).fill(0.8); -descA.usage = MLTensorUsage.WRITE; descA.writable = true; -descB.usage = MLTensorUsage.WRITE; descB.writable = true; const tensorA = await context.createTensor(descA); const tensorB = await context.createTensor(descB); @@ -24,7 +22,6 @@ const tensorC = await context.createTensor({ dataType: 'float32', dimensions: [3, 3], shape: [3, 3], - usage: MLTensorUsage.READ, readable: true, }); context.dispatch(graph, {a: tensorA, b: tensorB}, {c: tensorC}); diff --git a/code/samples/mul_add.js b/code/samples/mul_add.js index 6e9e3ecf..6698e2f1 100644 --- a/code/samples/mul_add.js +++ b/code/samples/mul_add.js @@ -12,7 +12,6 @@ const graph = await builder.build({'C': C}); // 3. Bind inputs to the graph and execute for the result. const bufferA = new Float32Array(4).fill(1.0); const bufferB = new Float32Array(4).fill(0.8); -desc.usage = MLTensorUsage.WRITE; desc.writable = true; const tensorA = await context.createTensor(desc); const tensorB = await context.createTensor(desc); @@ -20,7 +19,6 @@ context.writeTensor(tensorA, bufferA); context.writeTensor(tensorB, bufferB); const tensorC = await context.createTensor({ ...desc, - usage: MLTensorUsage.READ, readable: true, writable: false, }); diff --git a/code/samples/simple_graph.js b/code/samples/simple_graph.js index efb724ea..fb59b8cb 100644 --- a/code/samples/simple_graph.js +++ b/code/samples/simple_graph.js @@ -51,7 +51,6 @@ const graph = await builder.build({'output': output}); const inputBuffer1 = new Float32Array(TENSOR_SIZE).fill(1); const inputBuffer2 = new Float32Array(TENSOR_SIZE).fill(1); -desc.usage = MLTensorUsage.WRITE; desc.writable = true; const inputTensor1 = await context.createTensor(desc); const inputTensor2 = await context.createTensor(desc); @@ -60,7 +59,6 @@ context.writeTensor(inputTensor2, inputBuffer2); const outputTensor = await context.createTensor({ ...desc, - usage: MLTensorUsage.READ, readable: true, writable: false, }); diff --git a/face_recognition/.eslintrc.js b/face_recognition/.eslintrc.js index a05e0180..c02d313a 100644 --- a/face_recognition/.eslintrc.js +++ b/face_recognition/.eslintrc.js @@ -1,7 +1,6 @@ module.exports = { globals: { 'MLGraphBuilder': 'readonly', - 'MLTensorUsage': 'readonly', 'tf': 'readonly', }, }; diff --git a/face_recognition/facenet_nchw.js b/face_recognition/facenet_nchw.js index 1fdbea1a..4d5834e8 100644 --- a/face_recognition/facenet_nchw.js +++ b/face_recognition/facenet_nchw.js @@ -149,14 +149,12 @@ export class FaceNetNchw { shape: this.inputOptions.inputShape, }; const input = this.builder_.input('input', inputDesc); - inputDesc.usage = MLTensorUsage.WRITE; inputDesc.writable = true; this.inputTensor_ = await this.context_.createTensor(inputDesc); this.outputTensor_ = await this.context_.createTensor({ dataType: 'float32', dimensions: this.outputShape_, shape: this.outputShape_, - usage: MLTensorUsage.READ, readable: true, }); diff --git a/face_recognition/facenet_nhwc.js b/face_recognition/facenet_nhwc.js index 64946d97..38936df4 100644 --- a/face_recognition/facenet_nhwc.js +++ b/face_recognition/facenet_nhwc.js @@ -150,14 +150,12 @@ export class FaceNetNhwc { shape: this.inputOptions.inputShape, }; const input = this.builder_.input('input', inputDesc); - inputDesc.usage = MLTensorUsage.WRITE; inputDesc.writable = true; this.inputTensor_ = await this.context_.createTensor(inputDesc); this.outputTensor_ = await this.context_.createTensor({ dataType: 'float32', dimensions: this.outputShape_, shape: this.outputShape_, - usage: MLTensorUsage.READ, readable: true, }); diff --git a/facial_landmark_detection/.eslintrc.js b/facial_landmark_detection/.eslintrc.js index a05e0180..c02d313a 100644 --- a/facial_landmark_detection/.eslintrc.js +++ b/facial_landmark_detection/.eslintrc.js @@ -1,7 +1,6 @@ module.exports = { globals: { 'MLGraphBuilder': 'readonly', - 'MLTensorUsage': 'readonly', 'tf': 'readonly', }, }; diff --git a/facial_landmark_detection/face_landmark_nchw.js b/facial_landmark_detection/face_landmark_nchw.js index 5821bc2a..e0773346 100644 --- a/facial_landmark_detection/face_landmark_nchw.js +++ b/facial_landmark_detection/face_landmark_nchw.js @@ -78,14 +78,12 @@ export class FaceLandmarkNchw { shape: this.inputOptions.inputShape, }; const input = this.builder_.input('input', inputDesc); - inputDesc.usage = MLTensorUsage.WRITE; inputDesc.writable = true; this.inputTensor_ = await this.context_.createTensor(inputDesc); this.outputTensor_ = await this.context_.createTensor({ dataType: 'float32', dimensions: this.outputShape_, shape: this.outputShape_, - usage: MLTensorUsage.READ, readable: true, }); diff --git a/facial_landmark_detection/face_landmark_nhwc.js b/facial_landmark_detection/face_landmark_nhwc.js index fdaa3586..42920325 100644 --- a/facial_landmark_detection/face_landmark_nhwc.js +++ b/facial_landmark_detection/face_landmark_nhwc.js @@ -79,14 +79,12 @@ export class FaceLandmarkNhwc { shape: this.inputOptions.inputShape, }; const input = this.builder_.input('input', inputDesc); - inputDesc.usage = MLTensorUsage.WRITE; inputDesc.writable = true; this.inputTensor_ = await this.context_.createTensor(inputDesc); this.outputTensor_ = await this.context_.createTensor({ dataType: 'float32', dimensions: this.outputShape_, shape: this.outputShape_, - usage: MLTensorUsage.READ, readable: true, }); diff --git a/facial_landmark_detection/ssd_mobilenetv2_face_nchw.js b/facial_landmark_detection/ssd_mobilenetv2_face_nchw.js index 76ad51f1..bf2abdfe 100644 --- a/facial_landmark_detection/ssd_mobilenetv2_face_nchw.js +++ b/facial_landmark_detection/ssd_mobilenetv2_face_nchw.js @@ -125,7 +125,6 @@ ${nameArray[1]}`; shape: this.inputOptions.inputShape, }; const input = this.builder_.input('input', inputDesc); - inputDesc.usage = MLTensorUsage.WRITE; inputDesc.writable = true; this.inputTensor_ = await this.context_.createTensor(inputDesc); for (const [key, value] of Object.entries(this.outputsInfo)) { @@ -133,7 +132,6 @@ ${nameArray[1]}`; dataType: 'float32', dimensions: value, shape: value, - usage: MLTensorUsage.READ, readable: true, }); } diff --git a/facial_landmark_detection/ssd_mobilenetv2_face_nhwc.js b/facial_landmark_detection/ssd_mobilenetv2_face_nhwc.js index dadf5a95..0bc4e25b 100644 --- a/facial_landmark_detection/ssd_mobilenetv2_face_nhwc.js +++ b/facial_landmark_detection/ssd_mobilenetv2_face_nhwc.js @@ -136,7 +136,6 @@ ${nameArray[1]}`; shape: this.inputOptions.inputShape, }; const input = this.builder_.input('input', inputDesc); - inputDesc.usage = MLTensorUsage.WRITE; inputDesc.writable = true; this.inputTensor_ = await this.context_.createTensor(inputDesc); for (const [key, value] of Object.entries(this.outputsInfo)) { @@ -144,7 +143,6 @@ ${nameArray[1]}`; dataType: 'float32', dimensions: value, shape: value, - usage: MLTensorUsage.READ, readable: true, }); } diff --git a/image_classification/.eslintrc.js b/image_classification/.eslintrc.js index 74432882..41955769 100644 --- a/image_classification/.eslintrc.js +++ b/image_classification/.eslintrc.js @@ -1,6 +1,5 @@ module.exports = { globals: { 'MLGraphBuilder': 'readonly', - 'MLTensorUsage': 'readonly', }, }; diff --git a/image_classification/efficientnet_fp16_nchw.js b/image_classification/efficientnet_fp16_nchw.js index 3bf9d373..e0502108 100644 --- a/image_classification/efficientnet_fp16_nchw.js +++ b/image_classification/efficientnet_fp16_nchw.js @@ -83,14 +83,12 @@ export class EfficientNetFP16Nchw { shape: this.inputOptions.inputShape, }; let data = this.builder_.input('input', inputDesc); - inputDesc.usage = MLTensorUsage.WRITE; inputDesc.writable = true; this.inputTensor_ = await this.context_.createTensor(inputDesc); this.outputTensor_ = await this.context_.createTensor({ dataType: 'float32', dimensions: this.outputShape_, shape: this.outputShape_, - usage: MLTensorUsage.READ, readable: true, }); data = this.builder_.cast(data, 'float16'); diff --git a/image_classification/mobilenet_nchw.js b/image_classification/mobilenet_nchw.js index 6a3b4879..6687a519 100644 --- a/image_classification/mobilenet_nchw.js +++ b/image_classification/mobilenet_nchw.js @@ -97,14 +97,12 @@ export class MobileNetV2Nchw { shape: this.inputOptions.inputShape, }; let data = this.builder_.input('input', inputDesc); - inputDesc.usage = MLTensorUsage.WRITE; inputDesc.writable = true; this.inputTensor_ = await this.context_.createTensor(inputDesc); this.outputTensor_ = await this.context_.createTensor({ dataType: 'float32', dimensions: this.outputShape_, shape: this.outputShape_, - usage: MLTensorUsage.READ, readable: true, }); if (this.dataType_ === 'float16') { diff --git a/image_classification/mobilenet_nhwc.js b/image_classification/mobilenet_nhwc.js index ff59d3f2..2e89ff85 100644 --- a/image_classification/mobilenet_nhwc.js +++ b/image_classification/mobilenet_nhwc.js @@ -98,14 +98,12 @@ export class MobileNetV2Nhwc { shape: this.inputOptions.inputShape, }; const input = this.builder_.input('input', inputDesc); - inputDesc.usage = MLTensorUsage.WRITE; inputDesc.writable = true; this.inputTensor_ = await this.context_.createTensor(inputDesc); this.outputTensor_ = await this.context_.createTensor({ dataType: 'float32', dimensions: this.outputShape_, shape: this.outputShape_, - usage: MLTensorUsage.READ, readable: true, }); const conv0 = this.buildConv_( diff --git a/image_classification/resnet50v1_fp16_nchw.js b/image_classification/resnet50v1_fp16_nchw.js index db4035cb..86a119df 100644 --- a/image_classification/resnet50v1_fp16_nchw.js +++ b/image_classification/resnet50v1_fp16_nchw.js @@ -84,14 +84,12 @@ export class ResNet50V1FP16Nchw { shape: this.inputOptions.inputShape, }; let data = this.builder_.input('input', inputDesc); - inputDesc.usage = MLTensorUsage.WRITE; inputDesc.writable = true; this.inputTensor_ = await this.context_.createTensor(inputDesc); this.outputTensor_ = await this.context_.createTensor({ dataType: 'float32', dimensions: this.outputShape_, shape: this.outputShape_, - usage: MLTensorUsage.READ, readable: true, }); data = this.builder_.cast(data, 'float16'); diff --git a/image_classification/resnet50v2_nchw.js b/image_classification/resnet50v2_nchw.js index 17a56104..d45e269b 100644 --- a/image_classification/resnet50v2_nchw.js +++ b/image_classification/resnet50v2_nchw.js @@ -106,14 +106,12 @@ export class ResNet50V2Nchw { shape: this.inputOptions.inputShape, }; const data = this.builder_.input('input', inputDesc); - inputDesc.usage = MLTensorUsage.WRITE; inputDesc.writable = true; this.inputTensor_ = await this.context_.createTensor(inputDesc); this.outputTensor_ = await this.context_.createTensor({ dataType: 'float32', dimensions: this.outputShape_, shape: this.outputShape_, - usage: MLTensorUsage.READ, readable: true, }); const bn1 = this.buildBatchNorm_(data, '0', '', false); diff --git a/image_classification/resnet50v2_nhwc.js b/image_classification/resnet50v2_nhwc.js index 01af991d..89e4b3ef 100644 --- a/image_classification/resnet50v2_nhwc.js +++ b/image_classification/resnet50v2_nhwc.js @@ -132,14 +132,12 @@ export class ResNet50V2Nhwc { shape: this.inputOptions.inputShape, }; const input = this.builder_.input('input', inputDesc); - inputDesc.usage = MLTensorUsage.WRITE; inputDesc.writable = true; this.inputTensor_ = await this.context_.createTensor(inputDesc); this.outputTensor_ = await this.context_.createTensor({ dataType: 'float32', dimensions: this.outputShape_, shape: this.outputShape_, - usage: MLTensorUsage.READ, readable: true, }); const conv1 = await this.buildConv_( diff --git a/image_classification/squeezenet_nchw.js b/image_classification/squeezenet_nchw.js index 9ee5300f..677a45ce 100644 --- a/image_classification/squeezenet_nchw.js +++ b/image_classification/squeezenet_nchw.js @@ -51,14 +51,12 @@ export class SqueezeNetNchw { shape: this.inputOptions.inputShape, }; const data = this.builder_.input('input', inputDesc); - inputDesc.usage = MLTensorUsage.WRITE; inputDesc.writable = true; this.inputTensor_ = await this.context_.createTensor(inputDesc); this.outputTensor_ = await this.context_.createTensor({ dataType: 'float32', dimensions: this.outputShape_, shape: this.outputShape_, - usage: MLTensorUsage.READ, readable: true, }); const conv0 = this.buildConv_(data, 'conv0', {strides: [2, 2]}); diff --git a/image_classification/squeezenet_nhwc.js b/image_classification/squeezenet_nhwc.js index 44f86668..f1d2cb9d 100644 --- a/image_classification/squeezenet_nhwc.js +++ b/image_classification/squeezenet_nhwc.js @@ -66,14 +66,12 @@ export class SqueezeNetNhwc { shape: this.inputOptions.inputShape, }; const placeholder = this.builder_.input('input', inputDesc); - inputDesc.usage = MLTensorUsage.WRITE; inputDesc.writable = true; this.inputTensor_ = await this.context_.createTensor(inputDesc); this.outputTensor_ = await this.context_.createTensor({ dataType: 'float32', dimensions: this.outputShape_, shape: this.outputShape_, - usage: MLTensorUsage.READ, readable: true, }); const conv1 = this.buildConv_( diff --git a/lenet/.eslintrc.cjs b/lenet/.eslintrc.cjs index 65e5eb7e..c204ab87 100644 --- a/lenet/.eslintrc.cjs +++ b/lenet/.eslintrc.cjs @@ -2,7 +2,6 @@ module.exports = { ignorePatterns: ['libs/'], globals: { 'MLGraphBuilder': 'readonly', - 'MLTensorUsage': 'readonly', 'BigInt64Array': 'readonly', 'mnist': 'readonly', }, diff --git a/lenet/lenet.js b/lenet/lenet.js index 7f70470f..fafabaee 100644 --- a/lenet/lenet.js +++ b/lenet/lenet.js @@ -34,14 +34,12 @@ export class LeNet { shape: inputShape, }; let input = this.builder_.input('input', inputDesc); - inputDesc.usage = MLTensorUsage.WRITE; inputDesc.writable = true; this.inputTensor_ = await this.context_.createTensor(inputDesc); this.outputTensor_ = await this.context_.createTensor({ dataType: 'float32', dimensions: this.outputShape_, shape: this.outputShape_, - usage: MLTensorUsage.READ, readable: true, }); if (this.layout_ === 'nhwc') { diff --git a/nnotepad/.eslintrc.js b/nnotepad/.eslintrc.js index 23c8ee1f..329c64ed 100644 --- a/nnotepad/.eslintrc.js +++ b/nnotepad/.eslintrc.js @@ -1,5 +1,4 @@ module.exports = { env: {'es6': true, 'browser': true, 'jquery': false, 'node': true}, parserOptions: {ecmaVersion: 2021, sourceType: 'module'}, - globals: {'MLTensorUsage': 'readonly'}, }; diff --git a/nnotepad/js/nnotepad.js b/nnotepad/js/nnotepad.js index 315b9f5a..51e8dc24 100644 --- a/nnotepad/js/nnotepad.js +++ b/nnotepad/js/nnotepad.js @@ -40,7 +40,7 @@ class WebNNUtil { const isShapeMethod = typeof operand.shape === 'function'; const operandShape = isShapeMethod ? operand.shape() : operand.shape; const operandDataType = isShapeMethod ? operand.dataType() : - operand.dataType; + operand.dataType; const size = [...operandShape].reduce((a, b) => a * b, 1); const ctor = WebNNUtil.dataTypeToBufferType(operandDataType); return Reflect.construct(ctor, [size]); @@ -52,7 +52,6 @@ class WebNNUtil { dataType: isShapeMethod ? operand.dataType() : operand.dataType, dimensions: isShapeMethod ? operand.shape() : operand.shape, shape: isShapeMethod ? operand.shape() : operand.shape, - usage: MLTensorUsage.READ, readable: true, }; const tensor = await context.createTensor(desc); diff --git a/nsnet2/.eslintrc.js b/nsnet2/.eslintrc.js index a91c39a0..b738e919 100644 --- a/nsnet2/.eslintrc.js +++ b/nsnet2/.eslintrc.js @@ -2,7 +2,6 @@ module.exports = { ignorePatterns: ['libs/'], globals: { 'MLGraphBuilder': 'readonly', - 'MLTensorUsage': 'readonly', 'tf': 'readonly', }, }; diff --git a/nsnet2/nsnet2.js b/nsnet2/nsnet2.js index 401f9dd6..b3893abe 100644 --- a/nsnet2/nsnet2.js +++ b/nsnet2/nsnet2.js @@ -46,7 +46,6 @@ export class NSNet2 { const inputDesc = {dataType: 'float32', dimensions: inputShape, shape: inputShape}; const input = this.builder_.input('input', inputDesc); - inputDesc.usage = MLTensorUsage.WRITE; inputDesc.writable = true; this.inputTensor_ = await this.context_.createTensor(inputDesc); @@ -64,7 +63,6 @@ export class NSNet2 { const squeeze95 = this.builder_.reshape(gru93, squeeze95Shape); const initialState155 = this.builder_.input('initialState155', initialStateDesc); - initialStateDesc.usage = MLTensorUsage.WRITE; initialStateDesc.writable = true; this.initialState92Tensor_ = await this.context_.createTensor(initialStateDesc); this.initialState155Tensor_ = await this.context_.createTensor(initialStateDesc); @@ -73,7 +71,6 @@ export class NSNet2 { dataType: 'float32', dimensions: inputShape, shape: inputShape, // Same as inputShape. - usage: MLTensorUsage.READ, readable: true, }); const gruOutputShape = [1, batchSize, this.hiddenSize]; @@ -81,7 +78,6 @@ export class NSNet2 { dataType: 'float32', dimensions: gruOutputShape, shape: gruOutputShape, - usage: MLTensorUsage.READ, readable: true, }; this.gru94Tensor_ = await this.context_.createTensor(gruOutputDesc); diff --git a/object_detection/.eslintrc.js b/object_detection/.eslintrc.js index 74432882..41955769 100644 --- a/object_detection/.eslintrc.js +++ b/object_detection/.eslintrc.js @@ -1,6 +1,5 @@ module.exports = { globals: { 'MLGraphBuilder': 'readonly', - 'MLTensorUsage': 'readonly', }, }; diff --git a/object_detection/ssd_mobilenetv1_nchw.js b/object_detection/ssd_mobilenetv1_nchw.js index 2f3c53bf..8a30b6a8 100644 --- a/object_detection/ssd_mobilenetv1_nchw.js +++ b/object_detection/ssd_mobilenetv1_nchw.js @@ -93,21 +93,18 @@ ${nameArray[1]}_BatchNorm_batchnorm`; shape: this.inputOptions.inputShape, }; let input = this.builder_.input('input', inputDesc); - inputDesc.usage = MLTensorUsage.WRITE; inputDesc.writable = true; this.inputTensor_ = await this.context_.createTensor(inputDesc); this.boxesTensor_ = await this.context_.createTensor({ dataType: 'float32', dimensions: this.boxesShape_, shape: this.boxesShape_, - usage: MLTensorUsage.READ, readable: true, }); this.scoresTensor_ = await this.context_.createTensor({ dataType: 'float32', dimensions: this.scoresShape_, shape: this.scoresShape_, - usage: MLTensorUsage.READ, readable: true, }); diff --git a/object_detection/ssd_mobilenetv1_nhwc.js b/object_detection/ssd_mobilenetv1_nhwc.js index 9be23ebd..3eff76d5 100644 --- a/object_detection/ssd_mobilenetv1_nhwc.js +++ b/object_detection/ssd_mobilenetv1_nhwc.js @@ -99,21 +99,18 @@ ${nameArray[1]}_BatchNorm_batchnorm`; shape: this.inputOptions.inputShape, }; const input = this.builder_.input('input', inputDesc); - inputDesc.usage = MLTensorUsage.WRITE; inputDesc.writable = true; this.inputTensor_ = await this.context_.createTensor(inputDesc); this.boxesTensor_ = await this.context_.createTensor({ dataType: 'float32', dimensions: this.boxesShape_, shape: this.boxesShape_, - usage: MLTensorUsage.READ, readable: true, }); this.scoresTensor_ = await this.context_.createTensor({ dataType: 'float32', dimensions: this.scoresShape_, shape: this.scoresShape_, - usage: MLTensorUsage.READ, readable: true, }); diff --git a/object_detection/tiny_yolov2_nchw.js b/object_detection/tiny_yolov2_nchw.js index db080c14..61980822 100644 --- a/object_detection/tiny_yolov2_nchw.js +++ b/object_detection/tiny_yolov2_nchw.js @@ -74,14 +74,12 @@ export class TinyYoloV2Nchw { shape: this.inputOptions.inputShape, }; let image = this.builder_.input('input', inputDesc); - inputDesc.usage = MLTensorUsage.WRITE; inputDesc.writable = true; this.inputTensor_ = await this.context_.createTensor(inputDesc); this.outputTensor_ = await this.context_.createTensor({ dataType: 'float32', dimensions: this.outputShape_, shape: this.outputShape_, - usage: MLTensorUsage.READ, readable: true, }); diff --git a/object_detection/tiny_yolov2_nhwc.js b/object_detection/tiny_yolov2_nhwc.js index 79c20671..d16b7518 100644 --- a/object_detection/tiny_yolov2_nhwc.js +++ b/object_detection/tiny_yolov2_nhwc.js @@ -68,14 +68,12 @@ export class TinyYoloV2Nhwc { shape: this.inputOptions.inputShape, }; const input = this.builder_.input('input', inputDesc); - inputDesc.usage = MLTensorUsage.WRITE; inputDesc.writable = true; this.inputTensor_ = await this.context_.createTensor(inputDesc); this.outputTensor_ = await this.context_.createTensor({ dataType: 'float32', dimensions: this.outputShape_, shape: this.outputShape_, - usage: MLTensorUsage.READ, readable: true, }); diff --git a/rnnoise/.eslintrc.js b/rnnoise/.eslintrc.js index ddb387c4..96ef1071 100644 --- a/rnnoise/.eslintrc.js +++ b/rnnoise/.eslintrc.js @@ -2,7 +2,6 @@ module.exports = { ignorePatterns: ['process/', 'utils/'], globals: { 'MLGraphBuilder': 'readonly', - 'MLTensorUsage': 'readonly', 'Module': 'readonly', }, }; diff --git a/rnnoise/rnnoise.js b/rnnoise/rnnoise.js index 212482a7..a75acfa4 100644 --- a/rnnoise/rnnoise.js +++ b/rnnoise/rnnoise.js @@ -66,7 +66,6 @@ export class RNNoise { shape: [this.batchSize_, this.frames_, this.featureSize], }; const input = this.builder_.input('input', inputDesc); - inputDesc.usage = MLTensorUsage.WRITE; inputDesc.writable = true; this.inputTensor_ = await this.context_.createTensor(inputDesc); @@ -89,7 +88,6 @@ export class RNNoise { }; const vadGruInitialH = this.builder_.input( 'vadGruInitialH', vadGruInitialHDesc); - vadGruInitialHDesc.usage = MLTensorUsage.WRITE; vadGruInitialHDesc.writable = true; this.vadGruInitialHTensor_ = await this.context_.createTensor( vadGruInitialHDesc); @@ -125,7 +123,6 @@ export class RNNoise { }; const noiseGruInitialH = this.builder_.input( 'noiseGruInitialH', noiseGruInitialHDesc); - noiseGruInitialHDesc.usage = MLTensorUsage.WRITE; noiseGruInitialHDesc.writable = true; this.noiseGruInitialHTensor_ = await this.context_.createTensor( noiseGruInitialHDesc); @@ -161,7 +158,6 @@ export class RNNoise { }; const denoiseGruInitialH = this.builder_.input( 'denoiseGruInitialH', denoiseGruInitialHDesc); - denoiseGruInitialHDesc.usage = MLTensorUsage.WRITE; denoiseGruInitialHDesc.writable = true; this.denoiseGruInitialHTensor_ = await this.context_.createTensor( denoiseGruInitialHDesc); @@ -191,7 +187,6 @@ export class RNNoise { dataType: 'float32', dimensions: denoiseOutputShape, shape: denoiseOutputShape, - usage: MLTensorUsage.READ, readable: true, }); const vadGruYHOutputShape = @@ -200,7 +195,6 @@ export class RNNoise { dataType: 'float32', dimensions: vadGruYHOutputShape, shape: vadGruYHOutputShape, - usage: MLTensorUsage.READ, readable: true, }); const noiseGruYHOutputShape = @@ -209,7 +203,6 @@ export class RNNoise { dataType: 'float32', dimensions: noiseGruYHOutputShape, shape: noiseGruYHOutputShape, - usage: MLTensorUsage.READ, readable: true, }); const denoiseGruYHOutputShape = [ @@ -221,7 +214,6 @@ export class RNNoise { dataType: 'float32', dimensions: denoiseGruYHOutputShape, shape: denoiseGruYHOutputShape, - usage: MLTensorUsage.READ, readable: true, }); diff --git a/semantic_segmentation/.eslintrc.js b/semantic_segmentation/.eslintrc.js index c99d4448..788c3263 100644 --- a/semantic_segmentation/.eslintrc.js +++ b/semantic_segmentation/.eslintrc.js @@ -1,7 +1,6 @@ module.exports = { globals: { 'MLGraphBuilder': 'readonly', - 'MLTensorUsage': 'readonly', 'iro': 'readonly', 'tf': 'readonly', }, diff --git a/semantic_segmentation/deeplabv3_mnv2_nchw.js b/semantic_segmentation/deeplabv3_mnv2_nchw.js index 565a25a1..44432efc 100644 --- a/semantic_segmentation/deeplabv3_mnv2_nchw.js +++ b/semantic_segmentation/deeplabv3_mnv2_nchw.js @@ -96,14 +96,12 @@ export class DeepLabV3MNV2Nchw { shape: this.inputOptions.inputShape, }; const input = this.builder_.input('input', inputDesc); - inputDesc.usage = MLTensorUsage.WRITE; inputDesc.writable = true; this.inputTensor_ = await this.context_.createTensor(inputDesc); this.outputTensor_ = await this.context_.createTensor({ dataType: 'float32', dimensions: this.outputShape, shape: this.outputShape, - usage: MLTensorUsage.READ, readable: true, }); diff --git a/semantic_segmentation/deeplabv3_mnv2_nhwc.js b/semantic_segmentation/deeplabv3_mnv2_nhwc.js index 29e64a5b..5327bc9c 100644 --- a/semantic_segmentation/deeplabv3_mnv2_nhwc.js +++ b/semantic_segmentation/deeplabv3_mnv2_nhwc.js @@ -91,14 +91,12 @@ export class DeepLabV3MNV2Nhwc { shape: this.inputOptions.inputShape, }; const input = this.builder_.input('input', inputDesc); - inputDesc.usage = MLTensorUsage.WRITE; inputDesc.writable = true; this.inputTensor_ = await this.context_.createTensor(inputDesc); this.outputTensor_ = await this.context_.createTensor({ dataType: 'float32', dimensions: this.outputShape, shape: this.outputShape, - usage: MLTensorUsage.READ, readable: true, }); diff --git a/style_transfer/.eslintrc.js b/style_transfer/.eslintrc.js index 74432882..41955769 100644 --- a/style_transfer/.eslintrc.js +++ b/style_transfer/.eslintrc.js @@ -1,6 +1,5 @@ module.exports = { globals: { 'MLGraphBuilder': 'readonly', - 'MLTensorUsage': 'readonly', }, }; diff --git a/style_transfer/fast_style_transfer_net.js b/style_transfer/fast_style_transfer_net.js index 0f3630db..cfc5b13f 100644 --- a/style_transfer/fast_style_transfer_net.js +++ b/style_transfer/fast_style_transfer_net.js @@ -123,14 +123,12 @@ export class FastStyleTransferNet { shape: this.inputOptions.inputShape, }; const input = this.builder_.input('input', inputDesc); - inputDesc.usage = MLTensorUsage.WRITE; inputDesc.writable = true; this.inputTensor_ = await this.context_.createTensor(inputDesc); this.outputTensor_ = await this.context_.createTensor({ dataType: 'float32', dimensions: this.outputShape, shape: this.outputShape, - usage: MLTensorUsage.READ, readable: true, });