维科纳蒂 »
×
改变方向
在 Codepen 上打开
更改主题,深色/浅色
<!DOCTYPE html> <html> <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs"></script> <body> <h1>TensorFlow JavaScript</h1> <h3>Отримайте масиви за тензором:</h3> <div id="demo"></div> <script> const myArr = [[1, 2], [3, 4]]; const shape = [2, 2]; const tensorA = tf.tensor(myArr, shape); tensorA.array().then(array => display(array[0])); // Результат: 1,2 function display(data) { document.getElementById("demo").innerHTML = data; } </script> </body> </html>