graph_devices.https.any.js (682B)
1 // META: title=test graph.devices 2 // META: global=window 3 // META: variant=?cpu 4 // META: variant=?gpu 5 // META: variant=?npu 6 // META: script=../resources/utils.js 7 // META: timeout=long 8 9 'use strict'; 10 11 if (navigator.ml) { 12 promise_test(async () => { 13 const context = await navigator.ml.createContext(contextOptions); 14 const builder = new MLGraphBuilder(context); 15 const a = builder.input('A', {dataType: 'float32', shape: []}); 16 const o = builder.add(a, a); 17 const graph = await builder.build({'o': o}); 18 assert_greater_than(graph.devices.length, 0, 'graph.devices is empty.'); 19 }); 20 } else { 21 test(() => assert_implements(navigator.ml, 'missing navigator.ml')); 22 }