Skip to content
This repository was archived by the owner on Apr 18, 2023. It is now read-only.
This repository was archived by the owner on Apr 18, 2023. It is now read-only.

[webml/NNAPI] No exception is thrown when passing an invalid argument to addOperand() #80

Open
@canxcao

Description

@canxcao

Test Env:
Chromium Version : nightly build 65.0.3324.0 (revision f9e1a31)
OS : Android 8.1.0;Pixel 2

Expected Result:
Pass an invalid argument to addOperand(), it should throw an exception

Actual Result:
No exception is thrown when passing an invalid argument to addOperand()

How to reproduce:
Pass the following invalid arguments to addOperand():

TENSOR_FLOAT32 type: no "dimensions"
TENSOR_INT32 type: no "dimensions"
TENSOR_QUANT8_ASYMM type: no "dimensions"
TENSOR_QUANT8_ASYMM type: no "scale"
TENSOR_QUANT8_ASYMM type: no "zeroPoint"
TENSOR_QUANT8_ASYMM type: no "scale" and "zeroPoint"
TENSOR_QUANT8_ASYMM type: "zeroPoint" < 0
TENSOR_QUANT8_ASYMM type: "zeroPoint" > 255
TENSOR_QUANT8_ASYMM type: "scale" is negative
addOperand() only requires one argument, passing two arguments should raise an error: two scalars or two tensors
For example:
1.TENSOR_FLOAT32 type: no "dimensions":

it('raise error when passing a TENSOR_FLOAT32 tensor not having "dimensions" option', function() {
  return nn.createModel(options).then((model)=>{
    assert.throws(() => {
      model.addOperand({type: nn.TENSOR_FLOAT32});
    });
  });
});

2.addOperand() only requires one argument, passing two arguments should raise an error: pass two scalars

it('raise error when passing two scalars', function() {
  return nn.createModel(options).then((model)=>{
    assert.throws(() => {
      model.addOperand({type: nn.INT32}, {type: nn.INT32});
    });
  });
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    AndroidbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions