Skip to content

Instantly share code, notes, and snippets.

@astojilj
Created January 29, 2019 10:00
Show Gist options
  • Save astojilj/4ce6b26807b9f9636dbe81c7efba4166 to your computer and use it in GitHub Desktop.
Save astojilj/4ce6b26807b9f9636dbe81c7efba4166 to your computer and use it in GitHub Desktop.
benchmark packed conv2D by matmul + expensive packed reshape
diff --git a/integration_tests/benchmarks/benchmark_test.ts b/integration_tests/benchmarks/benchmark_test.ts
index 8148ea22..e883b11c 100644
--- a/integration_tests/benchmarks/benchmark_test.ts
+++ b/integration_tests/benchmarks/benchmark_test.ts
@@ -40,9 +40,9 @@ describe('benchmarks', () => {
});
it('conv2d', async done => {
- const sizes = [10, 100, 227];
+ const sizes = [10, 227, 513];
const convParams: RegularConvParams =
- {inDepth: 16, outDepth: 32, filterSize: 5, stride: 1, pad: 'same'};
+ {inDepth: 16, outDepth: 32, filterSize: 1, stride: 1, pad: 'same'};
const benchmark = new ConvGPUBenchmark();
await test_util.benchmarkAndLog(
diff --git a/integration_tests/benchmarks/conv_benchmarks.ts b/integration_tests/benchmarks/conv_benchmarks.ts
index 3ab22dbb..35c8fbaf 100644
--- a/integration_tests/benchmarks/conv_benchmarks.ts
+++ b/integration_tests/benchmarks/conv_benchmarks.ts
@@ -38,6 +38,7 @@ export interface DepthwiseConvParams extends ConvParams {
export class ConvGPUBenchmark implements BenchmarkTest {
async run(size: number, opType: string, params: ConvParams): Promise<number> {
tf.setBackend('webgl');
+ tf.ENV.set('WEBGL_PACK', true);
const inDepth = params.inDepth;
const inShape: [number, number, number] = [size, size, inDepth];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment