learning_model 1.0.51 → 1.0.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@
5
5
  ///////////////////////////////////////////////////////////////////////////
6
6
 
7
7
  import * as tf from '@tensorflow/tfjs';
8
- import '@tensorflow/tfjs-backend-wasm'; // WebAssembly 백엔드 추가
8
+ import { setWasmPaths } from '@tensorflow/tfjs-backend-wasm';
9
9
  import { dispose } from '@tensorflow/tfjs';
10
10
  import { io } from '@tensorflow/tfjs-core';
11
11
  import LearningInterface from './base';
@@ -201,8 +201,6 @@ class LearningMobilenet implements LearningInterface {
201
201
  private async setupBackend() {
202
202
  const isWasmSupported = await this.checkWasmSupport();
203
203
  if (isWasmSupported) {
204
- await tf.setBackend('wasm');
205
- await tf.ready();
206
204
  console.log('Backend is set to WebAssembly');
207
205
  } else {
208
206
  await tf.setBackend('cpu');
@@ -213,6 +211,8 @@ class LearningMobilenet implements LearningInterface {
213
211
 
214
212
  private async checkWasmSupport(): Promise<boolean> {
215
213
  try {
214
+ const wasmVersion = tf.version['tfjs-backend-wasm'] || tf.version['tfjs-core'];
215
+ setWasmPaths(`https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@${wasmVersion}/dist/`);
216
216
  await tf.setBackend('wasm');
217
217
  await tf.ready();
218
218
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "learning_model",
3
- "version": "1.0.51",
3
+ "version": "1.0.52",
4
4
  "description": "learning model develop",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,8 +21,7 @@
21
21
  "@tensorflow/tfjs": "^4.6.0",
22
22
  "@tensorflow/tfjs-layers": "^4.6.0",
23
23
  "@tensorflow/tfjs-backend-wasm": "^4.20.0",
24
- "canvas": "^2.11.2",
25
- "learning_model": "^1.0.0"
24
+ "canvas": "^2.11.2"
26
25
  },
27
26
  "devDependencies": {
28
27
  "@babel/core": "^7.15.0",