(ColorfulCakeChen) CNN Height Width Resize

JavaScript performance comparison

Test case created by ColorfulCakeChen

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  // For loading library.
  let pathTensorflow = "https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@2.0.0";
  let pathTensorflowWASM = "https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm/dist/tf-backend-wasm.js";
  let pathTestCase = "https://cdn.jsdelivr.net/gh/ColorfulCakeChen/query-submit-canvas@95a08dff5534587ddbbec9183f01a92a1bc52642/CNN/jsPerf/jsPerf_CNNHeightWidthResize.js";
  
  class ScriptLoader {
    /**
     * @param {string}  url      The URL of the script to be loaded.
     * @param {boolean} isModule If true, the script will be loaded as javascript module.
     * @return A promise. It resolves when the script is loaded.
     */
    static createPromise(url, isModule) {
      return new Promise((resolve, reject) => {
        let attributes = { src:url, onload:e=>resolve(e), onerror:e=>reject(e) };
        if (isModule)
          attributes.type = "module";
  
        document.head.appendChild(Object.assign(document.createElement("script"), 
    attributes));
      });
    }
  }
  
  
  async function libraryLoader() {
  
    await ScriptLoader.createPromise( pathTensorflow );
  //  await ScriptLoader.createPromise( pathTensorflowWASM );
    await ScriptLoader.createPromise( pathTestCase, true );
  
    console.log("library loaded.");
  
    await globalThis.testCaseLoader();
  }
  
  var libraryLoaderPromise;
  
  if ( globalThis.tf ) {
    //console.log("Library already loaded.");
    libraryLoaderPromise = Promise.resolve();
  } else {
    console.log("library loading...");
  //  libraryLoaderPromise = new Promise( ( resolve, reject ) => {
  //    libraryLoader.then( () => {
  //      resolve();  // LibraryLoaderPromise done.
  //  });
    libraryLoaderPromise = libraryLoader();
  }

};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
dummy (For waiting library loaded)
// async test
libraryLoaderPromise.then( () => {
  // Library loaded. Wait (to slow down testing) and finish.
//  setTimeout( () => { deferred.resolve(); }, 500 );
  tf.nextFrame().then( () => { deferred.resolve(); } );
});
pending…
ResizeNearestNeighbor
testCase.test_ResizeNearestNeighbor();
//testCase.test_DepthwiseConv2d_3x3_Stride2(); // DepthwiseConv2d 3x3 Stride2
pending…
ResizeBilinear
testCase.test_ResizeBilinear();
pending…
DAvg_101x101_OneStep
testCase.testFiltersArray[ 0 ].apply( testCase.dataTensor3d );
pending…
DAvg_101x101_1x1_OneStep
testCase.testFiltersArray[ 1 ].apply( testCase.dataTensor3d );
pending…
DMax_101x101_OneStep
testCase.testFiltersArray[ 2 ].apply( testCase.dataTensor3d );
pending…
DConv_101x101_OneStep
testCase.testFiltersArray[ 3 ].apply( testCase.dataTensor3d );
pending…
DConv_101x101_1x1_OneStep
testCase.testFiltersArray[ 4 ].apply( testCase.dataTensor3d );
pending…
DAvg_2x2_MultiStep
testCase.testFiltersArray[ 5 ].apply( testCase.dataTensor3d );
pending…
DMax_2x2_MultiStep
testCase.testFiltersArray[ 6 ].apply( testCase.dataTensor3d );
pending…
DConv_2x2_MultiStep
testCase.testFiltersArray[ 7 ].apply( testCase.dataTensor3d );
pending…
DConv_2x2_1x1_MultiStep
testCase.testFiltersArray[ 8 ].apply( testCase.dataTensor3d );
pending…
DConv_3x3_MultiStep
testCase.testFiltersArray[ 9 ].apply( testCase.dataTensor3d );
pending…
DConv_6x6_MultiStep
testCase.testFiltersArray[ 10 ].apply( testCase.dataTensor3d );
pending…
DConv_11x11_MultiStep
testCase.testFiltersArray[ 11 ].apply( testCase.dataTensor3d );
pending…

You can edit these tests or add even more tests to this page by appending /edit to the URL.

0 Comments