跳到主要内容

tf.dot

2025年02月10日
柏拉文
越努力,越幸运

一、认识


tf.dotTensorFlow.js 中用于计算计算两个矩阵或向量 t1t2 的点积。

二、语法


const a = tf.tensor1d([1, 2]);
const b = tf.tensor2d([[1, 2], [3, 4]]);
const c = tf.tensor2d([[1, 2, 3], [4, 5, 6]]);

a.dot(b).print(); // or tf.dot(a, b)
b.dot(a).print();
b.dot(c).print();