টেনসর ডট প্রোডাক্ট (ডিফল্ট axes)
numpy.tensordot() ফাংশন ডিফল্টভাবে axes=2 ধরে (শেষ ২ অক্ষ এবং প্রথম ২ অক্ষ)।
উদাহরণ কোড
import numpy as np
arr1 = np.array(range(1, 9)).reshape(2, 2, 2)
arr2 = np.array(['p', 'q', 'r', 's'], dtype=object).reshape(2, 2)
print("Array1...\n", arr1)
print("\nArray2...\n", arr2)
print("\nDimensions of Array1...\n", arr1.ndim)
print("\nDimensions of Array2...\n", arr2.ndim)
print("\nShape of Array1...\n", arr1.shape)
print("\nShape of Array2...\n", arr2.shape)
# ডিফল্ট axes
result = np.tensordot(arr1, arr2)
print("\nTensor Dot Product (default axes):\n", result)
আউটপুট
Array1...
[[[1 2] [3 4]] [[5 6] [7 8]]]
Array2...
[['p' 'q'] ['r' 's']]
Dimensions of Array1... 3
Dimensions of Array2... 2
Shape of Array1... (2, 2, 2)
Shape of Array2... (2, 2)
Tensor Dot Product (default axes):
['pqqrrrssss' 'pppppqqqqqqrrrrrrrssssssss']