license import * as tf from '@tensorflow/tfjs' ; import * as path from 'path' ; import { ProgbarLogger } from './callbacks' ; import { nodeFileSystemRouter } from './io/file_system' ; import * as nodeIo from './io/index' ; import { NodeJSKernelBackend } from './nodejs_kernel_backend' ; import { TFJSBinding } from './tfjs_binding' ; import * as nodeVersion from './version' ; const binary = require ( 'node-pre-gyp' ) ; const bindingPath = binary . find ( path . resolve ( path . join ( __dirname , '/../package.json' ) ) ) ; const bindings = require ( bindingPath ) ; export const version = { ... tf . version , 'tfjs-node' : nodeVersion . version } ; export const io = { ... tf . io , ... nodeIo } ; export * from '@tensorflow/tfjs' ; export * from './node' ; const pjson = require ( '../package.json' ) ; tf . registerBackend ( 'tensorflow' , ( ) => { return new NodeJSKernelBackend ( bindings as TFJSBinding , pjson . name ) ; } , 3 ) ; const success = tf . setBackend ( 'tensorflow' ) ; if ( ! success ) { throw new Error ( `Could not initialize TensorFlow backend.` ) ; } tf . io . registerLoadRouter ( nodeFileSystemRouter ) ; tf . io . registerSaveRouter ( nodeFileSystemRouter ) ; tf . registerCallbackConstructor ( 1 , ProgbarLogger ) ;