I'm trying to do the following broadcasting, but it is considered as error in Matft:
let a = Matft.arange(start: 1, to: 7, by: 1, shape: [3, 2])
let b = Matft.arange(start: 1, to: 5, by: 1, shape: [2, 1, 2])
print(a - b)
Error message:
Fatal error: could not broadcast from shape 3, [2, 1, 2] into shape 3, [1, 3, 2]: file /Users/alwc/Library/Developer/Xcode/DerivedData/testnpy-afxfserzcwmbfdfgfaszjulxzrwa/SourcePackages/checkouts/Matft/Sources/Matft/core/function/conversion.swift, line 290
2020-07-21 19:05:02.261713+0800 testnpy[21523:5245927] Fatal error: could not broadcast from shape 3, [2, 1, 2] into shape 3, [1, 3, 2]: file /Users/alwc/Library/Developer/Xcode/DerivedData/testnpy-afxfserzcwmbfdfgfaszjulxzrwa/SourcePackages/checkouts/Matft/Sources/Matft/core/function/conversion.swift, line 290
In Python this is legal. For example,
x = np.random.randint(10, size=(3, 2))
y = np.random.randint(10, size=(2, 1, 2))
# Returns a shape (2, 3, 2) nd-array
print(x - y)
Hi @jjjkkkjjj
I'm trying to do the following broadcasting, but it is considered as
error
inMatft
:Error message:
In Python this is legal. For example,