Pick TFLite delegate for Web CPU
PiperOrigin-RevId: 487611446
This commit is contained in:
parent
bb5782ee2f
commit
aeb2466844
|
@ -70,17 +70,11 @@ async function configureExternalFile(
|
||||||
|
|
||||||
/** Configues the `acceleration` option. */
|
/** Configues the `acceleration` option. */
|
||||||
function configureAcceleration(options: BaseOptions, proto: BaseOptionsProto) {
|
function configureAcceleration(options: BaseOptions, proto: BaseOptionsProto) {
|
||||||
if ('delegate' in options) {
|
const acceleration = proto.getAcceleration() ?? new Acceleration();
|
||||||
const acceleration = new Acceleration();
|
if (options.delegate === 'gpu') {
|
||||||
if (options.delegate === 'cpu') {
|
|
||||||
acceleration.setXnnpack(
|
|
||||||
new InferenceCalculatorOptions.Delegate.Xnnpack());
|
|
||||||
proto.setAcceleration(acceleration);
|
|
||||||
} else if (options.delegate === 'gpu') {
|
|
||||||
acceleration.setGpu(new InferenceCalculatorOptions.Delegate.Gpu());
|
acceleration.setGpu(new InferenceCalculatorOptions.Delegate.Gpu());
|
||||||
proto.setAcceleration(acceleration);
|
|
||||||
} else {
|
} else {
|
||||||
proto.clearAcceleration();
|
acceleration.setTflite(new InferenceCalculatorOptions.Delegate.TfLite());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
proto.setAcceleration(acceleration);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user