Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
554 views
in Technique[技术] by (71.8m points)

types - Numba signature: numba.core.errors.TypingError (3D float64 to 3D float32)

I want to compile a numba function that takes in input as 3D numpy array of float64 and returns a 3D numpy array of float32.

Code:

numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
No conversion from array(float64, 1d, C) to array(float32, 3d, A) for '$0.18', defined at None

Error:

from numba import njit, types

@njit('types.float32[:,:,:](types.float64[:,:,:])', parallel=True)
def my_function(img):
    img = img.transpose((2, 0, 1))
    img = (2 / 255) * img.astype(np.float32) - 1.0  # returns float32
    img = img.ravel()
    return img

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...