-
Notifications
You must be signed in to change notification settings - Fork 130
Add cpu op Pow, Expand, Cast, Shape, UpsampleV9 #214
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks good to me; 2 nits to take a look. Thanks for contributing to ONNX.js!
@@ -19,6 +19,21 @@ export class CpuUpsample extends Upsample { | |||
} | |||
} | |||
|
|||
export class CpuUpsampleV9 extends UpsampleV9 { | |||
run(inferenceHandler: CpuInferenceHandler, inputs: Tensor[]): Tensor[] { | |||
const scales = inputs[1].floatData; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since the scales are dynamic now, should we check the length?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be resolved
|
||
const output = new Tensor(dimensions, x.type); | ||
|
||
const result = BroadcastUtil.calc(x, output, (a, b) => a, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it equivalent to do BroadcastUtil.calc(output, x, (a, b) => b, true);
? if so we can do inplace broadcast
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, since the argument order is important and only the right hand side can be used for the inplace. Only a custom implementation or an extension of the BroadcastUtil
would work. Correct me if I am wrong
Explanation of why "test_cast_DOUBLE_to_FLOAT" failed: ONNX.js does not strictly using data types in ONNX - float/double is not treated differently (all |
But shouldn't this be the case the other way round? Seems odd to me. Also test output for (test_cast_DOUBLE_to_FLOAT) is:
The test should expect a float, but expects a double. Most likey the two tests names are switched? |
The test case (ONNX model) expects a |
Guess i missed the "input" in the error message |
To get my Model working, I needed some more ops.
I also "fixed" Slice to accept all number types, as the spec suggests.
I enabled the op-tests and also tested the runtime with my model.
![image](https://user-images.githubusercontent.com/9430219/91499713-4066cd80-e8c2-11ea-99a7-ec5125194843.png)