-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add a unit test to avoid forgetting about mixed dt with q8/fp a…
…nd relu operator
- Loading branch information
1 parent
7f72268
commit 20ba006
Showing
6 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version 1.0; | ||
|
||
extension tract_registry tract_core; | ||
|
||
fragment tract_core_properties( | ||
) -> (properties: (string, tensor<scalar>)[]) | ||
{ | ||
properties = [("tract_nnef_ser_version", "0.21.2-pre"), ("tract_nnef_format_version", "beta1")]; | ||
} | ||
|
||
graph network(input) -> (output) { | ||
input = external(shape = [2, 1, 3]); | ||
output_relu_y_3 = variable<scalar>(label = "output_relu_y_3", shape = [1, 1, 1]); | ||
output_raw = max(input, output_relu_y_3); | ||
foo = tract_core_cast(output_raw, to = "u8"); | ||
output = foo; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
"foo": zero_point_linear_quantize(zero_point = 2, scale = 0.003906250, bits = 8, signed = false, symmetric = false); | ||
"input": zero_point_linear_quantize(zero_point = 128, scale = 0.007812500, bits = 8, signed = false, symmetric = false); | ||
"output_raw": zero_point_linear_quantize(zero_point = 128, scale = 0.007812500, bits = 8, signed = false, symmetric = false); | ||
"output_relu_y_3": zero_point_linear_quantize(zero_point = 128, scale = 0.007812500, bits = 8, signed = false, symmetric = false); |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version 1.0; | ||
|
||
graph softmax_quant(input) -> (output) | ||
{ | ||
input = external<scalar>(shape = [2, 1, 3]); | ||
output = relu(input); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
"input": zero_point_linear_quantize(zero_point = 128, scale = 0.0078125, bits = 8, signed = false, symmetric = false); | ||
"output": zero_point_linear_quantize(zero_point = 2, scale = 0.00390625, bits = 8, signed = false, symmetric = false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/sh | ||
|
||
cd $(dirname $0) | ||
set -ex | ||
|
||
: ${TRACT_RUN:=cargo run -p tract $CARGO_OPTS --} | ||
|
||
rm -rf found | ||
$TRACT_RUN --nnef-tract-core ./model dump -q --nnef-dir found | ||
|
||
version=$(cargo metadata --format-version 1 | jq -r '.packages | map(select( (.name) == "tract-core") | .version) | .[] ') | ||
perl -pi -e "s/$version/0.21.2-pre/" found/graph.nnef | ||
|
||
diff expected found |