[doc] Update MLTensorUsage (#22127)

- WRITE_TO => WRITE
- READ_FROM => READ
This commit is contained in:
Wanming Lin 2024-09-19 00:35:23 +08:00 committed by GitHub
parent c990536309
commit 30e0696cea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -99,7 +99,7 @@ const mlContext = await navigator.ml.createContext({deviceType, ...});
const inputMLTensor = await mlContext.createTensor({
dataType: 'float32',
dimensions: [1, 3, 224, 224],
usage: MLTensorUsage.WRITE_TO,
usage: MLTensorUsage.WRITE,
});
mlContext.writeTensor(inputMLTensor, inputArrayBuffer);
@ -123,7 +123,7 @@ const mlContext = await navigator.ml.createContext({deviceType, ...});
const myPreAllocatedMLTensor = await mlContext.createTensor({
dataType: 'float32',
dimensions: [10, 1000],
usage: MLTensorUsage.READ_FROM,
usage: MLTensorUsage.READ,
});
const myPreAllocatedOutputTensor = ort.Tensor.fromMLTensor(myPreAllocatedMLTensor, {