运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <script src="https://cdn.jsdelivr.net.cn/npm/@tensorflow/tfjs"></script> <body> <h2>JavaScript</h2> <p>Adding 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 Addition const tensorNew = tensorA.add(tensorB); // Result: [ [2, 1], [5, 2], [8, 3] ] document.getElementById("demo").innerHTML = tensorNew; </script> </body> </html>