Simple code that works fine in python environment was rewritten to run in node js but I can't seem to get it to work.
The node js code looks like:
const tf = require('@tensorflow/tfjs-node');
var x= tf.constant([10, 20, 30])
var y= tf.constant([ 2, 3, 5])
var z= tf.divide(x, y)
I get the following errors when I run this code:
Overriding the gradient for 'Max'
Overriding the gradient for 'OneHot'
Overriding the gradient for 'PadV2'
Overriding the gradient for 'SpaceToBatchND'
Overriding the gradient for 'SplitV'
2020-07-01 13:31:52.548282: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-07-01 13:31:52.573722: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x104718410 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-07-01 13:31:52.573765: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
/Users/rodney/Desktop/node_code/ccx_MultiTool/playground/test18.js:3
var x= tf.constant([10, 20, 30])
^
TypeError: tf.constant is not a function
at Object.<anonymous> (/Users/rodney/Desktop/node_code/ccx_MultiTool/playground/test18.js:3:11)
at Module._compile (internal/modules/cjs/loader.js:1200:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
at Module.load (internal/modules/cjs/loader.js:1049:32)
at Function.Module._load (internal/modules/cjs/loader.js:937:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
(base)
I'd like to know two things:
- how to get rid of the overriding errors
- why I'm getting the TypeError: tf.constant is not a func
I'm running the code on a Macintosh 10.15.5 Catalina
and tf.version returns the following:
{
'tfjs-core': '2.0.1',
'tfjs-backend-cpu': '2.0.1',
'tfjs-backend-webgl': '2.0.1',
'tfjs-data': '2.0.1',
'tfjs-layers': '2.0.1',
'tfjs-converter': '2.0.1',
tfjs: '2.0.1',
'tfjs-node': '2.0.1'
}
Because this returns data I know that some things are working.