將兩個張量的切片成批相乘。
用法
tf.raw_ops.BatchMatMulV2(
x, y, adj_x=False, adj_y=False, name=None
)參數
-
x一個Tensor。必須是以下類型之一:bfloat16,half,float32,float64,int16,int32,int64,complex64,complex128。具有形狀[..., r_x, c_x]的二維或更高版本。 -
y一個Tensor。必須與x具有相同的類型。二維或更高,形狀為[..., r_y, c_y]。 -
adj_x可選的bool。默認為False。如果True,則與x的切片相鄰。默認為False。 -
adj_y可選的bool。默認為False。如果True,則與y的切片相鄰。默認為False。 -
name操作的名稱(可選)。
返回
-
一個
Tensor。具有與x相同的類型。
將 Tensor x 和 y 的所有切片相乘(每個切片都可以視為批次的一個元素),並將各個結果排列在具有相同批次大小的單個輸出張量中。通過將 adj_x 或 adj_y 標誌設置為 True ,默認情況下為 False ,每個單獨的切片都可以在乘法之前可選地連接(連接矩陣意味著轉置和共軛)。
輸入張量 x 和 y 是二維或更高的,形狀為 [..., r_x, c_x] 和 [..., r_y, c_y] 。
輸出張量為二維或更高,形狀為 [..., r_o, c_o] ,其中:
r_o = c_x if adj_x else r_x
c_o = r_y if adj_y else c_y
它被計算為:
輸出[...,:,:] = 矩陣(x[...,:,:]) * 矩陣(y[...,:,:])
注意: BatchMatMulV2支持批量維度的廣播。更多關於廣播這裏.
相關用法
- Python tf.raw_ops.BatchMatMulV3用法及代碼示例
- Python tf.raw_ops.BatchMatMul用法及代碼示例
- Python tf.raw_ops.BatchToSpaceND用法及代碼示例
- Python tf.raw_ops.BatchToSpace用法及代碼示例
- Python tf.raw_ops.BatchFunction用法及代碼示例
- Python tf.raw_ops.Bitcast用法及代碼示例
- Python tf.raw_ops.BitwiseAnd用法及代碼示例
- Python tf.raw_ops.BlockLSTM用法及代碼示例
- Python tf.raw_ops.BlockLSTMV2用法及代碼示例
- Python tf.raw_ops.BitwiseOr用法及代碼示例
- Python tf.raw_ops.BitwiseXor用法及代碼示例
- Python tf.raw_ops.BroadcastTo用法及代碼示例
- Python tf.raw_ops.TPUReplicatedInput用法及代碼示例
- Python tf.raw_ops.SelfAdjointEigV2用法及代碼示例
- Python tf.raw_ops.OneHot用法及代碼示例
- Python tf.raw_ops.ResourceScatterNdSub用法及代碼示例
- Python tf.raw_ops.ReadVariableXlaSplitND用法及代碼示例
- Python tf.raw_ops.GatherV2用法及代碼示例
- Python tf.raw_ops.Expm1用法及代碼示例
- Python tf.raw_ops.UniqueWithCounts用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.raw_ops.BatchMatMulV2。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
