Hi.
I'm planning to make web application to use tf.js.
I installed tensorflow.js from npm.
And I generated a sampleApp to use ares-webos-cli and added below test codes in body section.
<!-- Import TensorFlow.js -->
<script src="./node_modules/@tensorflow/tfjs/dist/tf.min.js"></script>
<script src="./node_modules/@tensorflow/tfjs-core/dist/tf-core.min.js"></script>
<!-- the main script -->
<script type="text/javascript">
console.log('tf.version : ', tf.version.tfjs);
var num1 = tf.scalar(1.0);
var num2 = tf.scalar(2.0);
var num3 = tf.scalar(10.0);
var num4 = tf.scalar(5.0);
console.log('tf.scalar ', num1.dataSync()[0], '+', num2.dataSync()[0], ': ', num1.add(num2).dataSync()[0]);
console.log('tf.scalar ', num1.dataSync()[0], '-', num2.dataSync()[0], ': ', num1.sub(num2).dataSync()[0]);
console.log('tf.scalar ', num1.dataSync()[0], '*', num2.dataSync()[0], ': ', num1.mul(num2).dataSync()[0]);
console.log('tf.scalar ', num1.dataSync()[0], '/', num2.dataSync()[0], ': ', num1.div(num2).dataSync()[0]);
console.log('tf.scalar ', num3.dataSync()[0], '/', num4.dataSync()[0], ': ', num3.div(num4).dataSync()[0]);
console.log('tf.scalar ', num3.dataSync()[0], '*', num4.dataSync()[0], ': ', num3.mul(num4).dataSync()[0]);
console.log('tf.scalar ', num1.dataSync()[0], '+', num2.dataSync()[0], ': ', num1.add(num2).dataSync()[0]);
console.log('tf.scalar ', num1.dataSync()[0], '-', num2.dataSync()[0], ': ', num1.sub(num2).dataSync()[0]);
console.log('tf.scalar ', num1.dataSync()[0], '*', num2.dataSync()[0], ': ', num1.mul(num2).dataSync()[0]);
However, I got errors during tensor division operation like below.
I expected 1 divided by 2 to get 0.5, but it got 0.
Also after division operation, tensor operations got some problems.
I'd like to know how to use tf.js in webOS OSE.
Any help would be greatly appreciated.
Thanks.