[英]Segmentation fault in numpy matmul
執行矩陣乘法時出現分段錯誤
expanded_model = np.matmul(M, model)
其中 M 和 model 具有尺寸
print(len(model), M.shape)
這使
1200 (2000, 1200)
矩陣和數組定義為
model = np.arange(1200, dtype=np.float64)
M = np.ndarray(shape=(2000, 1200), dtype=np.float64)
知道 go 會出現什么問題嗎?
>> *** Process received signal ***
>> Signal: Segmentation fault: 11 (11)
>> Signal code: Address not mapped (1)
>> Failing at address: 0x110
>> [ 0] 2 libsystem_platform.dylib 0x00007fff65e2cf5a _sigtramp + 26
>> [ 1] 3 libpython3.6m.dylib 0x000000010a548d3d convertitem + 5965
>> [ 2] 4 libBLAS.dylib 0x00007fff3a7a7a47 cblas_dgemv + 727
我認為使用np.ndarray()
創建數組不是一個好主意。 該文檔建議不要這樣做:
Arrays 應使用數組、零或空來構造(請參閱下面的另請參閱部分)。
看起來它包含垃圾,例如np.empty()
。 也許你想要一個隨機的M
開頭? 這有幫助嗎?
M = np.random.random((2000, 1200))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.