Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@jit
def myfunc1(self):
return self.attr0
def check(self):
assert self.myfunc(1) == 3
# FIXME support multilevel imported jitted function call in a jitted function
from .for_test_exterior_import_jit import foo, func_import, func_import2
from numpy import pi
const = 1
jitted_func_import = jit(func_import)
jitted_func_import2 = jit(func_import2)
@jit
def main(add: int):
return (
add
+ foo
+ pi
- pi
- jitted_func_import()
+ func_import2()
+ func0_jitted(1 / 2)
+ const
)
@jit
def main(add: int):
return (
add
+ foo
+ pi
- pi
- jitted_func_import()
+ func_import2()
+ func0_jitted(1 / 2)
+ const
)
@jit
def func_dict(d: "str: float dict"):
return d.popitem()
@jit
def func_identity(a):
return a
@jit(native=True, xsimd=True)
def row_sum(arr, columns):
return arr.T[columns].sum(0)
@jit()
def func(a: T, b: T):
return a * b
from transonic import jit
import numba
from pure_numpy import laplace_numpy, laplace_loops
laplace_transonic_pythran = jit(native=True, xsimd=True)(laplace_numpy)
laplace_transonic_python = jit(backend="python")(laplace_numpy)
laplace_transonic_numba = jit(backend="numba")(laplace_numpy)
laplace_numba = numba.njit(laplace_numpy)
laplace_transonic_pythran_loops = jit(native=True, xsimd=True)(laplace_loops)
laplace_transonic_python_loops = jit(backend="python")(laplace_loops)
laplace_transonic_numba_loops = jit(backend="numba")(laplace_loops)
laplace_numba_loops = numba.njit(laplace_loops)
if __name__ == "__main__":
from transonic import wait_for_all_extensions
from skimage.data import astronaut
from skimage.color import rgb2gray
image = astronaut()
image = rgb2gray(image)
# warm the functions
laplace_transonic_python(image)
laplace_transonic_pythran(image)
laplace_transonic_pythran_loops(image)
laplace_transonic_numba(image)
from transonic import jit
import numba
from pure_numpy import laplace_numpy, laplace_loops
laplace_transonic_pythran = jit(native=True, xsimd=True)(laplace_numpy)
laplace_transonic_python = jit(backend="python")(laplace_numpy)
laplace_transonic_numba = jit(backend="numba")(laplace_numpy)
laplace_numba = numba.njit(laplace_numpy)
laplace_transonic_pythran_loops = jit(native=True, xsimd=True)(laplace_loops)
laplace_transonic_python_loops = jit(backend="python")(laplace_loops)
laplace_transonic_numba_loops = jit(backend="numba")(laplace_loops)
laplace_numba_loops = numba.njit(laplace_loops)
if __name__ == "__main__":
from transonic import wait_for_all_extensions
from skimage.data import astronaut
from skimage.color import rgb2gray
image = astronaut()
image = rgb2gray(image)
from transonic import jit
import numba
from pure_numpy import laplace_numpy, laplace_loops
laplace_transonic_pythran = jit(native=True, xsimd=True)(laplace_numpy)
laplace_transonic_python = jit(backend="python")(laplace_numpy)
laplace_transonic_numba = jit(backend="numba")(laplace_numpy)
laplace_numba = numba.njit(laplace_numpy)
laplace_transonic_pythran_loops = jit(native=True, xsimd=True)(laplace_loops)
laplace_transonic_python_loops = jit(backend="python")(laplace_loops)
laplace_transonic_numba_loops = jit(backend="numba")(laplace_loops)
laplace_numba_loops = numba.njit(laplace_loops)
if __name__ == "__main__":
from transonic import wait_for_all_extensions
from skimage.data import astronaut
from skimage.color import rgb2gray
image = astronaut()
image = rgb2gray(image)
@jit
def calcul(self, a, b):
return a * self.attr0 + b * self.attr1