Babel includes JSX processing.
Any URL's added here will be added as
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
/*❗️❗️❗️ full article and example here: https://www.js-craft.io/blog/using-the-tensorflowjs-argmax-function */ // basic calls for argMax() const results = tf.tensor1d([0.12, 0.15, 0.98, 0.02]); results.argMax().print() tf.argMax(results).print() // extract the result of argMax() in its own variable const types = ['cat', 'dog', 'bird', 'mouse'] const predictions = tf.tensor1d([0.12, 0.15, 0.98, 0.02]) const index = predictions.argMax().arraySync() console.log('In the picture we have a ' + types[index]) // multi dimensional tensors argMax() const multiDTensor = tf.tensor2d([[0.12, 0.15], [0.98, 0.02]]); multiDTensor.argMax().print()
Also see: Tab Triggers