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

[test] Support new WebGL backend for test cases. #370

Merged
merged 1 commit into from
Dec 12, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,27 @@ function almostEqualCTS(a, b) {
}

function setOptions() {
// visit URL(http://domain-name/test/index.html?backend=webgl2) to test Unit Tests by WebGL2 backend
// visit URL(http://domain-name/test/index.html?backend=webgl) to test Unit Tests by WebGL backend
var parameterStr = window.location.search.substr(1);
var reg = new RegExp("(^|&)backend=([^&]*)(&|$)", "i");
var r = parameterStr.match(reg);
if (r != null) {
var backend = unescape(r[2]);
if (backend == "webgl2") {
var backend = unescape(r[2]).toLowerCase();
if (backend === "wasm") {
options = {
"useWebGL2": true
"backend": 'WASM'
};
} else if (backend == "bnns") {
} else if (backend === "webgl") {
options = {
"backend": 'WebGL'
};
} else if (backend === "cldnn") {
// use PREFER_SUSTAINED_SPEED for Linux/Windows clDNN backend
prefer = nn.PREFER_SUSTAINED_SPEED;
} else if (backend === "bnns") {
// use PREFER_FAST_SINGLE_ANSWER for MacOS BNNS backend
prefer = nn.PREFER_FAST_SINGLE_ANSWER;
} else if (backend == "mps") {
} else if (backend === "mps") {
// use PREFER_SUSTAINED_SPEED for MacOS MPS backend
prefer = nn.PREFER_SUSTAINED_SPEED;
// As MPS computes on FP16, use 5ULP of FP16 range
Expand Down