Search code examples
tensorflowtensorboardtensorflow.js

Use Tensorboard With Tensorflow.js


I would like to use tensorboard to visualize my model fitting.

The instructions for the tensorboard tutorial (which is for python) and in the API docs (JS) use tf.node.

But tf.node does not exist.

TypeError: Cannot read property 'summaryFileWriter' of undefined

My code:

require('@tensorflow/tfjs-node');
console.clear();
require('dotenv').config();
const debugTf = require('debug')('tf');
const debugTfVerbose = require('debug')('tf:verbose');
const tf = require('@tensorflow/tfjs');
const summaryWriter = tf.node.summaryFileWriter('/tmp/tfjs_tb_logdir');

I'm using "@tensorflow/tfjs-node": "^1.2.3"


Solution

  • According to the documentation, the namespace tf should be associated to the package tfjs-node instead of tf

    const tf = require('@tensorflow/tfjs-node');