tor-browser

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

linear.https.any.js (1312B)


      1 // META: title=validation tests for WebNN API linear 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 validateInputFromAnotherBuilder('linear');
     11 
     12 const label = 'linear_xxx';
     13 validateSingleInputOperation('linear', label);
     14 
     15 promise_test(async t => {
     16  const builder = new MLGraphBuilder(context);
     17  const options = {alpha: 1.5, beta: 0.3};
     18  const input = builder.input('input', {dataType: 'float32', shape: [1, 2, 3]});
     19  const output = builder.linear(input, options);
     20  assert_equals(output.dataType, 'float32');
     21  assert_array_equals(output.shape, [1, 2, 3]);
     22 }, '[linear] Build with options');
     23 
     24 promise_test(async t => {
     25  const builder = new MLGraphBuilder(context);
     26  const options = {beta: -Infinity};
     27  const input = builder.input('input', {dataType: 'float32', shape: []});
     28  assert_throws_js(TypeError, () => builder.linear(input, options));
     29 }, '[linear] Throw if options.beta is -Infinity');
     30 
     31 promise_test(async t => {
     32  const builder = new MLGraphBuilder(context);
     33  const options = {alpha: NaN};
     34  const input = builder.input('input', {dataType: 'float32', shape: [1]});
     35  assert_throws_js(TypeError, () => builder.linear(input, options));
     36 }, '[linear] Throw if options.alpha is NaN');