Skip to content
This repository was archived by the owner on Aug 15, 2019. It is now read-only.

Fix failing test in travis #1381

Merged
merged 3 commits into from
Nov 7, 2018
Merged
Show file tree
Hide file tree
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
16 changes: 8 additions & 8 deletions scripts/test-travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ if [[ $(node -v) = *v10* ]]; then

# Run the first karma separately so it can download the BrowserStack binary
# without conflicting with others.
yarn run-browserstack --browsers=bs_safari_mac --backend webgl
yarn run-browserstack --browsers=bs_safari_mac --backend webgl --features '{"WEBGL_CPU_FORWARD": false}'

# Run the rest of the karma tests in parallel. These runs will reuse the
# already downloaded binary.
npm-run-all -p -c --aggregate-output \
"run-browserstack --browsers=bs_safari_mac --features '{\"HAS_WEBGL\": false}' --backend cpu" \
"run-browserstack --browsers=bs_ios_11 --backend webgl" \
"run-browserstack --browsers=bs_ios_11 --features '{\"HAS_WEBGL\": false}' --backend cpu" \
"run-browserstack --browsers=bs_firefox_mac" \
"run-browserstack --browsers=bs_chrome_mac" \
"run-browserstack --browsers=bs_chrome_mac --features '{\"WEBGL_CPU_FORWARD\": true}' --backend webgl"
npm-run-all -p -c --aggregate-output \
"run-browserstack --browsers=bs_safari_mac --features '{\"HAS_WEBGL\": false}' --backend cpu" \
"run-browserstack --browsers=bs_ios_11 --backend webgl --features '{\"WEBGL_CPU_FORWARD\": false}'" \
"run-browserstack --browsers=bs_ios_11 --features '{\"HAS_WEBGL\": false}' --backend cpu" \
"run-browserstack --browsers=bs_firefox_mac" \
"run-browserstack --browsers=bs_chrome_mac" \
"run-browserstack --browsers=bs_chrome_mac --features '{\"WEBGL_CPU_FORWARD\": true}' --backend webgl"
fi
27 changes: 18 additions & 9 deletions src/ops/matmul_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,31 +293,40 @@ describeWithFlags('matmul', ALL_ENVS, () => {
it('batched matmul with the matrices being vectors', () => {
const batch = 3;
const sharedDim = 10000;
const a = tf.fill([batch, 1, sharedDim], 0.1);
const b = tf.fill([batch, sharedDim, 1], 0.1);
const values = new Float32Array(batch * sharedDim);
values[10] = 2;

const a = tf.tensor(values, [batch, 1, sharedDim]);
const b = tf.tensor(values, [batch, sharedDim, 1]);
const result = tf.matMul(a, b);
expect(result.shape).toEqual([batch, 1, 1]);
expectArraysClose(result, [100, 100, 100]);
expectArraysClose(result, [4, 0, 0]);
});

it('batched matmul with matrix x vector', () => {
const batch = 3;
const sharedDim = 10000;
const a = tf.fill([batch, 2, sharedDim], 0.1);
const b = tf.fill([batch, sharedDim, 1], 0.1);
const values = new Float32Array(batch * sharedDim);
values[10] = 2;

const a = tf.ones([batch, 2, sharedDim]);
const b = tf.tensor(values, [batch, sharedDim, 1]);
const result = tf.matMul(a, b);
expect(result.shape).toEqual([batch, 2, 1]);
expectArraysClose(result, [100, 100, 100, 100, 100, 100]);
expectArraysClose(result, [2, 2, 0, 0, 0, 0]);
});

it('batched matmul with vector x matrix', () => {
const batch = 3;
const sharedDim = 10000;
const a = tf.fill([batch, 1, sharedDim], 0.1);
const b = tf.fill([batch, sharedDim, 2], 0.1);
const values = new Float32Array(batch * sharedDim);
values[10] = 2;

const a = tf.tensor(values, [batch, 1, sharedDim]);
const b = tf.ones([batch, sharedDim, 2]);
const result = tf.matMul(a, b);
expect(result.shape).toEqual([batch, 1, 2]);
expectArraysClose(result, [100, 100, 100, 100, 100, 100]);
expectArraysClose(result, [2, 2, 0, 0, 0, 0]);
});

it('Matrix * vector propagates NaNs', () => {
Expand Down