Skip to content

Commit

Permalink
Remove throw at promise
Browse files Browse the repository at this point in the history
  • Loading branch information
axinging committed Nov 4, 2022
1 parent a42df3e commit 2c191b7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 2 additions & 3 deletions e2e/benchmarks/model_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ const benchmarks = {
},
'Coco-SSD': {
type: 'GraphModel',
supportDump: false,
// The model has has the dynamic ops, so it is supposed to use executeAsync.
architectures: ['MobileNetV2', 'MobileNetV1', 'liteMobileNetV2'],
load: async (inputResolution = 227, modelArchitecture = 'MobileNetV2') => {
Expand Down Expand Up @@ -329,7 +328,6 @@ const benchmarks = {
},
'AutoML Object': {
type: 'GraphModel',
supportDump: false,
load: async () => {
const url =
'https://storage.googleapis.com/tfjs-testing/tfjs-automl/object_detection/model.json';
Expand Down Expand Up @@ -370,7 +368,6 @@ const benchmarks = {
},
'TextToxicity': {
type: 'GraphModel',
supportDump: false,
// The model has has the dynamic ops, so it is supposed to use executeAsync.
load: async () => {
const url =
Expand Down Expand Up @@ -478,6 +475,8 @@ const benchmarks = {
}
},
'speech-commands': {
// Sequential model doesn't support dump.
supportDump: false,
load: async () => {
const recognizer = speechCommands.create('BROWSER_FFT');
await recognizer.ensureModelLoaded();
Expand Down
7 changes: 3 additions & 4 deletions tfjs-converter/src/executor/graph_executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ export class GraphExecutor implements FunctionExecutor {
Object.entries(tensorsMap).map(([name, tensorsList]) => {
return [
name, tensorsList.map(tensor => {
if (tensor == null) {
return null;
}
const clone = tensor.clone();
keep(clone);
return clone;
Expand Down Expand Up @@ -557,10 +560,6 @@ export class GraphExecutor implements FunctionExecutor {
}
const currentContext = context.currentContext;
if (util.isPromise(tensors)) {
if (this.keepIntermediateTensors) {
throw new Error(
'Keep intermediate tensors is not supported for operator returns promises!');
}
promises.push(tensors.then(t => {
tensorMap[nodeName] = t;
context.currentContext = currentContext;
Expand Down

0 comments on commit 2c191b7

Please sign in to comment.