运行 ❯
获取您
自己
的网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <script src="https://cdn.jsdelivr.net.cn/npm/@tensorflow/tfjs"></script> <body> <h2>JavaScript</h2> <p>Subtracting tensors with tensorflow.js</p> <div id="demo"></div> <script> const tensorA = tf.tensor([[1, 2], [3, 4], [5, 6]]); const tensorB = tf.tensor([[1,-1], [2,-2], [3,-3]]); // Tensor Subtraction const tensorNew = tensorA.sub(tensorB); // Result: [ [0, 3], [1, 6], [2, 9] ] document.getElementById("demo").innerHTML = tensorNew; </script> </body> </html>