提交 f722a622 编写于 作者: F fangzhou0329

bugfix

Signed-off-by: Nfangzhou0329 <fangzhou12@huawei.com>
上级 c9f4ced6
...@@ -408,7 +408,7 @@ syscontext.resourceManager.getRawFileContent(inputName).then(async (buffer) => { ...@@ -408,7 +408,7 @@ syscontext.resourceManager.getRawFileContent(inputName).then(async (buffer) => {
let mindSporeLiteModel = await mindSporeLite.loadModelFromFile(model_file); let mindSporeLiteModel = await mindSporeLite.loadModelFromFile(model_file);
const modelInputs = mindSporeLiteModel.getInputs(); const modelInputs = mindSporeLiteModel.getInputs();
modelInputs[0].setData(inputBuffer.buffer); modelInputs[0].setData(inputBuffer.buffer);
result.predict(modelInputs, (result) => { mindSporeLiteModel.predict(modelInputs, (result) => {
let output = new Float32Array(result[0].getData()); let output = new Float32Array(result[0].getData());
for (let i = 0; i < output.length; i++) { for (let i = 0; i < output.length; i++) {
console.log(output[i].toString()); console.log(output[i].toString());
...@@ -448,7 +448,7 @@ syscontext.resourceManager.getRawFileContent(inputName).then(async (buffer) => { ...@@ -448,7 +448,7 @@ syscontext.resourceManager.getRawFileContent(inputName).then(async (buffer) => {
let mindSporeLiteModel = await mindSporeLite.loadModelFromFile(model_file); let mindSporeLiteModel = await mindSporeLite.loadModelFromFile(model_file);
const modelInputs = mindSporeLiteModel.getInputs(); const modelInputs = mindSporeLiteModel.getInputs();
modelInputs[0].setData(inputBuffer.buffer); modelInputs[0].setData(inputBuffer.buffer);
result.predict(modelInputs).then((result) => { mindSporeLiteModel.predict(modelInputs).then((result) => {
let output = new Float32Array(result[0].getData()); let output = new Float32Array(result[0].getData());
for (let i = 0; i < output.length; i++) { for (let i = 0; i < output.length; i++) {
console.log(output[i].toString()); console.log(output[i].toString());
...@@ -549,7 +549,7 @@ syscontext.resourceManager.getRawFileContent(inputName).then(async (buffer) => { ...@@ -549,7 +549,7 @@ syscontext.resourceManager.getRawFileContent(inputName).then(async (buffer) => {
let mindSporeLiteModel = await mindSporeLite.loadModelFromFile(model_file); let mindSporeLiteModel = await mindSporeLite.loadModelFromFile(model_file);
const modelInputs = mindSporeLiteModel.getInputs(); const modelInputs = mindSporeLiteModel.getInputs();
modelInputs[0].setData(inputBuffer.buffer); modelInputs[0].setData(inputBuffer.buffer);
result.predict(modelInputs).then((result) => { mindSporeLiteModel.predict(modelInputs).then((result) => {
let output = new Float32Array(result[0].getData()); let output = new Float32Array(result[0].getData());
for (let i = 0; i < output.length; i++) { for (let i = 0; i < output.length; i++) {
console.log(output[i].toString()); console.log(output[i].toString());
...@@ -579,7 +579,7 @@ import resourceManager from '@ohos.resourceManager' ...@@ -579,7 +579,7 @@ import resourceManager from '@ohos.resourceManager'
let inputName = 'input_data.bin'; let inputName = 'input_data.bin';
let syscontext = globalThis.context; let syscontext = globalThis.context;
syscontext.resourceManager.getRawFileContent(inputName).then(async (buffer) => { syscontext.resourceManager.getRawFileContent(inputName).then(async (buffer) => {
inputBuffer = buffer; let inputBuffer = buffer;
let model_file = '/path/to/xxx.ms'; let model_file = '/path/to/xxx.ms';
let mindSporeLiteModel = await mindSporeLite.loadModelFromFile(model_file); let mindSporeLiteModel = await mindSporeLite.loadModelFromFile(model_file);
const modelInputs = mindSporeLiteModel.getInputs(); const modelInputs = mindSporeLiteModel.getInputs();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册