tfjs icon indicating copy to clipboard operation
tfjs copied to clipboard

How to get version info

Open MatPoliquin opened this issue 3 years ago • 3 comments

Similar to the main Tensorflow (i.e using "tf.__ version __"), is there a way to get the current version in tensorflow.js?

For WEBGL version there is: tf.env().get('WEBGL_VERSION') but for TF.JS version there seems to know flags or other ways available.

MatPoliquin avatar Jun 07 '22 20:06 MatPoliquin

If you're using the union package via import * as tf from '@tensorflow/tfjs', const tf = require('@tensorflow/tfjs'), or a script tag, the versions are exposed on the tf.version variable.

e.g.

> tf.version
{
  'tfjs-core': '3.18.0',
  'tfjs-backend-cpu': '3.18.0',
  'tfjs-backend-webgl': '3.18.0',
  'tfjs-data': '3.18.0',
  'tfjs-layers': '3.18.0',
  'tfjs-converter': '3.18.0',
  tfjs: '3.18.0'
}

If you're using individual packages, each package has its own version variable:

import * as core from '@tensorflow/tfjs-core';
import * as cpu from '@tensorflow/tfjs-backend-cpu';

console.log('core: ', core.version_core, 'cpu: ', cpu.version_cpu);
core:  3.18.0 cpu:  3.18.0

mattsoulanille avatar Jun 07 '22 21:06 mattsoulanille

Thank you!

Is there a reason why it's not included in the API doc? https://js.tensorflow.org/api/latest/

MatPoliquin avatar Jun 08 '22 11:06 MatPoliquin

@mattsoulanille I have submitted a change here https://github.com/tensorflow/tfjs-website/pull/461 , could you please review.

rthadur avatar Jun 08 '22 18:06 rthadur

please check the comments here https://github.com/tensorflow/tfjs-website/pull/461#issuecomment-1212552956 , we will not be implementing this change for now. Thank you!

rthadur avatar Dec 15 '22 21:12 rthadur