GithubHelp home page GithubHelp logo

bbernhar / webnn-native Goto Github PK

View Code? Open in Web Editor NEW

This project forked from webmachinelearning/webnn-native

0.0 0.0 0.0 32.44 MB

๐Ÿง  Standalone native implementation of the Web Neural Network API

License: Apache License 2.0

Python 2.82% JavaScript 1.88% C++ 93.95% C 1.32% Shell 0.03%

webnn-native's Introduction

clang format null backend DirectML backend

WebNN-native

WebNN-native is a native implementation of the Web Neural Network API.

It provides several building blocks:

  • WebNN C/C++ headers that applications and other building blocks use.
    • The webnn.h that is an one-to-one mapping with the WebNN IDL.
    • A C++ wrapper for the webnn.h
  • Backend implementations that use platforms' ML APIs:
    • DirectML on Windows 10
    • OpenVINO on Windows 10 and Linux
    • oneDNN on Windows 10 and Linux
    • XNNPACK on Windows 10 and Linux
    • Other backends are to be added

WebNN-native uses the code of other open source projects:

  • The code generator and infrastructure code of Dawn project.
  • The DirectMLX and device wrapper of DirectML project.
  • The XNNPACK project.
  • The oneDNN project.

Build and Run

Install depot_tools

WebNN-native uses the Chromium build system and dependency management so you need to install depot_tools and add it to the PATH.

Notes:

  • On Windows, you'll need to set the environment variable DEPOT_TOOLS_WIN_TOOLCHAIN=0. This tells depot_tools to use your locally installed version of Visual Studio (by default, depot_tools will try to download a Google-internal version).

Get the code

Get the source code as follows:

# Clone the repo as "webnn-native"
> git clone https://github.com/webmachinelearning/webnn-native.git webnn-native && cd webnn-native

# Bootstrap the gclient configuration
> cp scripts/standalone.gclient .gclient

# Fetch external dependencies and toolchains with gclient
> gclient sync

Setting up the build

Generate build files using gn args out/Debug or gn args out/Release.

A text editor will appear asking build options, the most common option is is_debug=true/false; otherwise gn args out/Release --list shows all the possible options.

To build with a backend, please set the corresponding option from following table.

Backend Option
DirectML webnn_enable_dml=true
OpenVINO webnn_enable_openvino=true
XNNPACK webnn_enable_xnnpack=true
oneDNN webnn_enable_onednn=true

Build

Then use ninja -C out/Release or ninja -C out/Debug to build WebNN-native.

Notes

Run tests

Run unit tests:

> ./out/Release/webnn_unittests

Run end2end tests on a default device:

> ./out/Release/webnn_end2end_tests

You can also specify a device to run end2end tests using "-d" option, for example:

> ./out/Release/webnn_end2end_tests -d gpu

Currently "cpu", "gpu" and "default" are supported, more devices are to be supported in the future.

Notes:

Run examples

License

Apache 2.0 Public License, please see LICENSE.

webnn-native's People

Contributors

brucedai avatar fujunwei avatar huningxin avatar lisa0314 avatar miaobin avatar mingmingtasd avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.