How should I load deeplearn js?

154 views Asked by At

At https://deeplearnjs.org/index.html#demos , it said the API will be available as 'dl', here's a print screen of the site:


enter image description here


but when I tried putting

<head><script src="https://unpkg.com/deeplearn"></script></head>
<body><script>var math = new dl.NDArrayMathGPU();

it prompted Uncaught ReferenceError: dl is not defined

How should I load it then?

2

There are 2 answers

0
ghybs On BEST ANSWER

The documentation might have a mistake.

It seems that the library is globally available as deeplearn instead of dl

0
Rocksetta On

either change dl to deeplearn or include this line

dl = deeplearn

For lots of examples try

https://hpssjellis.github.io/deeplearnjs-javascript-examples/