diff --git a/code/samples/matmul.js b/code/samples/matmul.js index 41b824aa..43eb93fd 100644 --- a/code/samples/matmul.js +++ b/code/samples/matmul.js @@ -13,7 +13,9 @@ const graph = await builder.build({c}); 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); context.writeTensor(tensorA, bufferA); @@ -23,6 +25,7 @@ const tensorC = await context.createTensor({ dimensions: [3, 3], shape: [3, 3], usage: MLTensorUsage.READ, + readable: true, }); context.dispatch(graph, {a: tensorA, b: tensorB}, {c: tensorC}); const results = await context.readTensor(tensorC); diff --git a/code/samples/mul_add.js b/code/samples/mul_add.js index a1c76fd5..66cb7fad 100644 --- a/code/samples/mul_add.js +++ b/code/samples/mul_add.js @@ -13,6 +13,7 @@ const graph = await builder.build({'C': C}); 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); context.writeTensor(tensorA, bufferA); @@ -20,6 +21,7 @@ context.writeTensor(tensorB, bufferB); const tensorC = await context.createTensor({ ...desc, usage: MLTensorUsage.READ, + readable: true, }); const inputs = {'A': tensorA, 'B': tensorB}; const outputs = {'C': tensorC}; diff --git a/code/samples/simple_graph.js b/code/samples/simple_graph.js index 8fa2a39d..bd6029af 100644 --- a/code/samples/simple_graph.js +++ b/code/samples/simple_graph.js @@ -52,6 +52,7 @@ 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); context.writeTensor(inputTensor1, inputBuffer1); @@ -60,6 +61,7 @@ context.writeTensor(inputTensor2, inputBuffer2); const outputTensor = await context.createTensor({ ...desc, usage: MLTensorUsage.READ, + readable: true, }); // Execute the compiled graph with the specified inputs. diff --git a/face_recognition/facenet_nchw.js b/face_recognition/facenet_nchw.js index 251c03bd..55de74ca 100644 --- a/face_recognition/facenet_nchw.js +++ b/face_recognition/facenet_nchw.js @@ -148,12 +148,14 @@ export class FaceNetNchw { }; 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 poolOptions = {windowDimensions: [3, 3], strides}; diff --git a/face_recognition/facenet_nhwc.js b/face_recognition/facenet_nhwc.js index 15190f44..12cf1544 100644 --- a/face_recognition/facenet_nhwc.js +++ b/face_recognition/facenet_nhwc.js @@ -149,12 +149,14 @@ export class FaceNetNhwc { }; 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 poolOptions = {windowDimensions: [3, 3], strides, layout: 'nhwc'}; diff --git a/facial_landmark_detection/face_landmark_nchw.js b/facial_landmark_detection/face_landmark_nchw.js index 88051821..5821bc2a 100644 --- a/facial_landmark_detection/face_landmark_nchw.js +++ b/facial_landmark_detection/face_landmark_nchw.js @@ -79,12 +79,14 @@ export class FaceLandmarkNchw { }; 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 poolOptions = diff --git a/facial_landmark_detection/face_landmark_nhwc.js b/facial_landmark_detection/face_landmark_nhwc.js index 262b0efc..fdaa3586 100644 --- a/facial_landmark_detection/face_landmark_nhwc.js +++ b/facial_landmark_detection/face_landmark_nhwc.js @@ -80,12 +80,14 @@ export class FaceLandmarkNhwc { }; 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 poolOptions = diff --git a/facial_landmark_detection/ssd_mobilenetv2_face_nchw.js b/facial_landmark_detection/ssd_mobilenetv2_face_nchw.js index 5f8610b8..9c146331 100644 --- a/facial_landmark_detection/ssd_mobilenetv2_face_nchw.js +++ b/facial_landmark_detection/ssd_mobilenetv2_face_nchw.js @@ -122,6 +122,7 @@ ${nameArray[1]}`; }; 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)) { this.outputTensors_[key] = await this.context_.createTensor({ @@ -129,6 +130,7 @@ ${nameArray[1]}`; 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 8b4482a7..c2cc6b7f 100644 --- a/facial_landmark_detection/ssd_mobilenetv2_face_nhwc.js +++ b/facial_landmark_detection/ssd_mobilenetv2_face_nhwc.js @@ -134,6 +134,7 @@ ${nameArray[1]}`; }; 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)) { this.outputTensors_[key] = await this.context_.createTensor({ @@ -141,6 +142,7 @@ ${nameArray[1]}`; dimensions: value, shape: value, usage: MLTensorUsage.READ, + readable: true, }); } diff --git a/image_classification/efficientnet_fp16_nchw.js b/image_classification/efficientnet_fp16_nchw.js index 17eed31e..3bf9d373 100644 --- a/image_classification/efficientnet_fp16_nchw.js +++ b/image_classification/efficientnet_fp16_nchw.js @@ -84,12 +84,14 @@ export class EfficientNetFP16Nchw { }; 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'); // Block 0 diff --git a/image_classification/mobilenet_nchw.js b/image_classification/mobilenet_nchw.js index afedf42a..6a3b4879 100644 --- a/image_classification/mobilenet_nchw.js +++ b/image_classification/mobilenet_nchw.js @@ -98,12 +98,14 @@ export class MobileNetV2Nchw { }; 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') { data = this.builder_.cast(data, 'float16'); diff --git a/image_classification/mobilenet_nhwc.js b/image_classification/mobilenet_nhwc.js index 122edc7d..3fc89bba 100644 --- a/image_classification/mobilenet_nhwc.js +++ b/image_classification/mobilenet_nhwc.js @@ -96,12 +96,14 @@ export class MobileNetV2Nhwc { }; 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_( input, '90', 'Conv_Conv2D', true, {strides, autoPad, filterLayout}); diff --git a/image_classification/resnet50v1_fp16_nchw.js b/image_classification/resnet50v1_fp16_nchw.js index 507446e5..db4035cb 100644 --- a/image_classification/resnet50v1_fp16_nchw.js +++ b/image_classification/resnet50v1_fp16_nchw.js @@ -85,12 +85,14 @@ export class ResNet50V1FP16Nchw { }; 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'); const conv1 = await this.buildConv_( diff --git a/image_classification/resnet50v2_nchw.js b/image_classification/resnet50v2_nchw.js index 52c9e1e6..17a56104 100644 --- a/image_classification/resnet50v2_nchw.js +++ b/image_classification/resnet50v2_nchw.js @@ -107,12 +107,14 @@ export class ResNet50V2Nchw { }; 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); const conv0 = this.buildConv_( diff --git a/image_classification/resnet50v2_nhwc.js b/image_classification/resnet50v2_nhwc.js index de1d4aaa..0988e6b2 100644 --- a/image_classification/resnet50v2_nhwc.js +++ b/image_classification/resnet50v2_nhwc.js @@ -129,12 +129,14 @@ export class ResNet50V2Nhwc { }; 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_( input, ['', '', '1'], {strides, padding: [3, 3, 3, 3]}, false); diff --git a/image_classification/squeezenet_nchw.js b/image_classification/squeezenet_nchw.js index e7f13e15..9ee5300f 100644 --- a/image_classification/squeezenet_nchw.js +++ b/image_classification/squeezenet_nchw.js @@ -52,12 +52,14 @@ export class SqueezeNetNchw { }; 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]}); const pool0 = this.builder_.maxPool2d( diff --git a/image_classification/squeezenet_nhwc.js b/image_classification/squeezenet_nhwc.js index d3d7e403..f7e50417 100644 --- a/image_classification/squeezenet_nhwc.js +++ b/image_classification/squeezenet_nhwc.js @@ -63,12 +63,14 @@ export class SqueezeNetNhwc { }; 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_( placeholder, 'conv1', {strides, autoPad: 'same-upper'}); diff --git a/lenet/lenet.js b/lenet/lenet.js index 21ebaaf2..7f70470f 100644 --- a/lenet/lenet.js +++ b/lenet/lenet.js @@ -35,12 +35,14 @@ export class LeNet { }; 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') { input = this.builder_.transpose( diff --git a/nnotepad/js/nnotepad.js b/nnotepad/js/nnotepad.js index a46eda7f..38a57c26 100644 --- a/nnotepad/js/nnotepad.js +++ b/nnotepad/js/nnotepad.js @@ -48,6 +48,7 @@ class WebNNUtil { dimensions: operand.shape(), shape: operand.shape(), usage: MLTensorUsage.READ, + readable: true, }; const tensor = await context.createTensor(desc); return tensor; diff --git a/nsnet2/nsnet2.js b/nsnet2/nsnet2.js index a7cb1445..f22819b6 100644 --- a/nsnet2/nsnet2.js +++ b/nsnet2/nsnet2.js @@ -47,6 +47,7 @@ export class NSNet2 { const input = this.builder_.input('input', inputDesc); inputDesc.usage = MLTensorUsage.WRITE; + inputDesc.writable = true; this.inputTensor_ = await this.context_.createTensor(inputDesc); const relu20 = this.builder_.relu(this.builder_.add(this.builder_.matmul(input, weight172), biasFcIn0)); @@ -63,6 +64,7 @@ export class NSNet2 { 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); @@ -71,6 +73,7 @@ export class NSNet2 { dimensions: inputShape, shape: inputShape, // Same as inputShape. usage: MLTensorUsage.READ, + readable: true, }); const gruOutputShape = [1, batchSize, this.hiddenSize]; const gruOutputDesc = { @@ -78,6 +81,7 @@ export class NSNet2 { dimensions: gruOutputShape, shape: gruOutputShape, usage: MLTensorUsage.READ, + readable: true, }; this.gru94Tensor_ = await this.context_.createTensor(gruOutputDesc); this.gru157Tensor_ = await this.context_.createTensor(gruOutputDesc); diff --git a/object_detection/ssd_mobilenetv1_nchw.js b/object_detection/ssd_mobilenetv1_nchw.js index b8f00e97..e5e525da 100644 --- a/object_detection/ssd_mobilenetv1_nchw.js +++ b/object_detection/ssd_mobilenetv1_nchw.js @@ -91,18 +91,21 @@ ${nameArray[1]}_BatchNorm_batchnorm`; }; 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, }); if (this.targetDataType_ === 'float16') { diff --git a/object_detection/ssd_mobilenetv1_nhwc.js b/object_detection/ssd_mobilenetv1_nhwc.js index dd98e1de..0d44feac 100644 --- a/object_detection/ssd_mobilenetv1_nhwc.js +++ b/object_detection/ssd_mobilenetv1_nhwc.js @@ -97,18 +97,21 @@ ${nameArray[1]}_BatchNorm_batchnorm`; }; 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, }); const strides = [2, 2]; diff --git a/object_detection/tiny_yolov2_nchw.js b/object_detection/tiny_yolov2_nchw.js index 1e90d374..0033212a 100644 --- a/object_detection/tiny_yolov2_nchw.js +++ b/object_detection/tiny_yolov2_nchw.js @@ -70,12 +70,14 @@ export class TinyYoloV2Nchw { }; 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, }); let mulScale = this.builder_.constant( diff --git a/object_detection/tiny_yolov2_nhwc.js b/object_detection/tiny_yolov2_nhwc.js index 94db9e0b..efeaf706 100644 --- a/object_detection/tiny_yolov2_nhwc.js +++ b/object_detection/tiny_yolov2_nhwc.js @@ -64,12 +64,14 @@ export class TinyYoloV2Nhwc { }; 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 poolOptions = { diff --git a/rnnoise/rnnoise.js b/rnnoise/rnnoise.js index 6d79271d..212482a7 100644 --- a/rnnoise/rnnoise.js +++ b/rnnoise/rnnoise.js @@ -67,6 +67,7 @@ export class RNNoise { }; const input = this.builder_.input('input', inputDesc); inputDesc.usage = MLTensorUsage.WRITE; + inputDesc.writable = true; this.inputTensor_ = await this.context_.createTensor(inputDesc); const inputDense0 = this.builder_.matmul(input, inputDenseKernel0); @@ -89,6 +90,7 @@ export class RNNoise { const vadGruInitialH = this.builder_.input( 'vadGruInitialH', vadGruInitialHDesc); vadGruInitialHDesc.usage = MLTensorUsage.WRITE; + vadGruInitialHDesc.writable = true; this.vadGruInitialHTensor_ = await this.context_.createTensor( vadGruInitialHDesc); @@ -124,6 +126,7 @@ export class RNNoise { const noiseGruInitialH = this.builder_.input( 'noiseGruInitialH', noiseGruInitialHDesc); noiseGruInitialHDesc.usage = MLTensorUsage.WRITE; + noiseGruInitialHDesc.writable = true; this.noiseGruInitialHTensor_ = await this.context_.createTensor( noiseGruInitialHDesc); @@ -159,6 +162,7 @@ export class RNNoise { const denoiseGruInitialH = this.builder_.input( 'denoiseGruInitialH', denoiseGruInitialHDesc); denoiseGruInitialHDesc.usage = MLTensorUsage.WRITE; + denoiseGruInitialHDesc.writable = true; this.denoiseGruInitialHTensor_ = await this.context_.createTensor( denoiseGruInitialHDesc); @@ -188,6 +192,7 @@ export class RNNoise { dimensions: denoiseOutputShape, shape: denoiseOutputShape, usage: MLTensorUsage.READ, + readable: true, }); const vadGruYHOutputShape = [this.vadGruNumDirections, this.batchSize_, this.vadGruHiddenSize]; @@ -196,6 +201,7 @@ export class RNNoise { dimensions: vadGruYHOutputShape, shape: vadGruYHOutputShape, usage: MLTensorUsage.READ, + readable: true, }); const noiseGruYHOutputShape = [this.noiseGruNumDirections, this.batchSize_, this.noiseGruHiddenSize]; @@ -204,6 +210,7 @@ export class RNNoise { dimensions: noiseGruYHOutputShape, shape: noiseGruYHOutputShape, usage: MLTensorUsage.READ, + readable: true, }); const denoiseGruYHOutputShape = [ this.denoiseGruNumDirections, @@ -215,6 +222,7 @@ export class RNNoise { dimensions: denoiseGruYHOutputShape, shape: denoiseGruYHOutputShape, usage: MLTensorUsage.READ, + readable: true, }); return {denoiseOutput, vadGruYH, noiseGruYH, denoiseGruYH}; diff --git a/semantic_segmentation/deeplabv3_mnv2_nchw.js b/semantic_segmentation/deeplabv3_mnv2_nchw.js index 1f915d9a..565a25a1 100644 --- a/semantic_segmentation/deeplabv3_mnv2_nchw.js +++ b/semantic_segmentation/deeplabv3_mnv2_nchw.js @@ -97,12 +97,14 @@ export class DeepLabV3MNV2Nchw { }; 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/semantic_segmentation/deeplabv3_mnv2_nhwc.js b/semantic_segmentation/deeplabv3_mnv2_nhwc.js index 3c472048..f4698a46 100644 --- a/semantic_segmentation/deeplabv3_mnv2_nhwc.js +++ b/semantic_segmentation/deeplabv3_mnv2_nhwc.js @@ -89,12 +89,14 @@ export class DeepLabV3MNV2Nhwc { }; 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 = await this.buildConv_( diff --git a/style_transfer/fast_style_transfer_net.js b/style_transfer/fast_style_transfer_net.js index 394943a3..08737229 100644 --- a/style_transfer/fast_style_transfer_net.js +++ b/style_transfer/fast_style_transfer_net.js @@ -121,12 +121,14 @@ export class FastStyleTransferNet { }; 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 conv2D0 = this.builder_.conv2d(this.builder_.pad(input, padding4, padding4, {mode: 'reflection'}), weightConv0);