Published
Edited
Apr 12, 2018
Insert cell
Insert cell
Insert cell
tf = require('@tensorflow/tfjs')
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
vector_a = tf.tensor1d([2,2])
Insert cell
vector_b = tf.tensor1d([4,1])
Insert cell
Insert cell
Insert cell
tf.add(vector_a, vector_b).data()
Insert cell
tf.sub(vector_a, vector_b).data()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
vector_a.norm().data()
Insert cell
Insert cell
// 2^2 + 2^2 = c^2
// c^2 = 4 + 4
// c = 8^.5

8**.5
Insert cell
Insert cell
tf.sub(vector_a, vector_b).norm().data()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more