Ginger
Ginger

Reputation: 8650

Numba: How to Suppress

I keep on getting this error in my numba code:

Warning 101:0: Unused argument 'self'

My numba code is below. How do I suppress the error message?

@autojit
def initialise_output_data(self, input_data, output_data, params ):

    # Unpack Params
    #omega = params['omega']
    #beta  = params['beta']
    #gamma = params['gamma']
    psi   = params['psi']    

    # Unpack Output Data
    mu    = output_data['mu']
    s2    = output_data['sigma2']        
    res   = output_data['residuals']
    res2  = output_data['residuals2']        

    # Initialise Garch Variables
    s2[0]   = input_data[ 'sample_var' ]
    res[0]  = psi[0] / ( 1.0-psi[1] )
    res2[0] = res[0]**2
    mu[0]   = psi[0] + psi[1]*res[0] 

Upvotes: 3

Views: 6638

Answers (2)

Prash Serai
Prash Serai

Reputation: 1

As autojit doesn't seem to exist anymore, and numba.jit doesn't accept the argument warn, some imperfect ways to handle this may be:

  1. Disable all Numba messages of level WARNING or lower

    import logging;
    logger = logging.getLogger("numba");
    logger.setLevel(logging.ERROR)
    
  2. Disable all messages of level WARNING or lower altogether

    import logging;
    logging.disable(logging.WARNING)
    

Upvotes: -1

jbn
jbn

Reputation: 691

You can suppress all numba warnings on a specific function with warn=False. For example:

@numba.autojit(warn=False)
def f(a, b):
    return a

f doesn't use b but numba does not issue a warning. This works for @numba.jit also. Just be careful!

Upvotes: 3

Related Questions