tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

cast.https.any.js (881B)


      1 // META: title=validation tests for WebNN API cast operation
      2 // META: global=window
      3 // META: variant=?cpu
      4 // META: variant=?gpu
      5 // META: variant=?npu
      6 // META: script=../resources/utils_validation.js
      7 
      8 'use strict';
      9 
     10 multi_builder_test(async (t, builder, otherBuilder) => {
     11  const inputFromOtherBuilder =
     12      otherBuilder.input('input', {dataType: 'int32', shape: [2, 2]});
     13 
     14  assert_throws_js(
     15      TypeError, () => builder.cast(inputFromOtherBuilder, 'int64'));
     16 }, '[cast] throw if input is from another builder');
     17 
     18 promise_test(async t => {
     19    const builder = new MLGraphBuilder(context);
     20    const input = builder.input('input', {
     21        dataType: 'int8',
     22        shape: [context.opSupportLimits().maxTensorByteLength / 2]});
     23    assert_throws_js(
     24        TypeError, () => builder.cast(input, 'int64'));
     25  }, '[cast] throw if the output tensor byte length exceeds limit');