尝试运行涉及 svd 函数的 for 循环时出现以下错误
TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Untyped global name 'svd': cannot determine Numba type of <class 'function'>
代码如下所示。
from scipy.linalg import svd
import numpy as np
from numba import jit
PatchSize = 5
@jit(nopython=True)
def svd_solver(image):
Hight = image.shape[0]
Width = image.shape[1]
for i in range(PatchSize):
for j in range(PatchSize):
Count = Count+1
Patch = ImgInput[i:Hight-PatchSize+i+1,j:Width-PatchSize+j+1]
SG_S, SG_V, SG_D = svd(Patch)
return SG_V