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
)
@boost
def func3(c: const(A1)):
return c[0] + 1
@boost
def test_sp_special(v: int, x: float):
return jv(v, x)
@boost
def test_np_fft(u: "float[]"):
u_fft = rfft(u)
return u_fft
def func0(a, b):
return a + b
func0_boosted = boost(func0)
A = Union[int, Array[int, "1d", "C"]]
@boost
def func2(a: A, b: float):
return a - func_tmp(b)
A1 = Array[int, "1d", "C", "memview"]
@boost
def func3(c: const(A1)):
return c[0] + 1
ts = Transonic()
def func1(a, b):
n = 10
if ts.is_transpiled:
result = ts.use_block("block0")
else:
def compare(result, dtype, ndim, memview, mem_layout=None, positive_indices=None):
A = Array[dtype, ndim, memview, mem_layout, positive_indices]
assert A.format_as_backend_type(type_formatter) == result
import numpy as np
import transonic as ts
from transonic import Type, NDim, Array, Union
T = Type("T")
T1 = Type("T1")
N = NDim("N")
A = Array[T, N]
A1 = Array[T1, N + 1]
# for coverage
assert repr(N - 1) == "N - 1"
print(repr(A1))
repr(Union[A, A1])
@ts.boost
def compute(a: A, b: A1, c: T, d: A, e: str):
print(e)
tmp = a + b
return tmp
@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