簡體   English   中英

numba 中的時間數據類型 - 在 Numba jitclass 規范/簽名中使用時間屬性

[英]time dtype in numba-Using time attribute in Numba jitclass spec/ signature

我正在使用 Numba、jitclass 來縮短我的執行時間。 我正在嘗試使用 jitclass 裝飾器在 myClass 中指定時間數據類型。 我嘗試了時間、日期時間、字符串、float64/32、numba.NPDattime 等,但出現錯誤。 在文檔中找不到任何內容。 我的代碼是......

spec = [ ('currtm',datetime.time)]

@jitclass(spec)
class myClass(object):
    def __init__(self): #
        
        self.currtm = time.time()

簡而言之,我需要 python 'time' 或 'datetime' 返回值的 numba 數據類型。 我檢查了 ans time 方法返回 float 但 numba 對此不友好。 我收到的錯誤是“TypeError: spec values should be Numba type instances, got <method 'time' of 'datetime.datetime' objects>”

問題是,在他們的文檔中看不到 Numba 類型的時間實例? 在舊版本中有一些提示,但似乎已被棄用。 知道怎么做嗎? 謝謝

已檢查,但 Numba 尚不支持它。 所以我必須使用 objemode 或 ctypes https://github.com/numba/numba/issues/4003

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM