from __future__ import print_function, division, absolute_import import numpy as np from numba import types, utils from numba import unittest_support as unittest from numba.compiler import compile_isolated, Flags from .support import TestCase, tag, MemoryLeakMixin looplift_flags = Flags() looplift_flags.set("enable_pyobject") looplift_flags.set("enable_looplift") pyobject_looplift_flags = looplift_flags.copy() pyobject_looplift_flags.set("enable_pyobject_looplift") def lift1(x): # Outer needs object mode because of np.empty() a = np.empty(3) for i in range(a.size): # Inner is nopython-compliant a[i] = x return a def lift2(x): # Outer needs object mode because of np.empty() a = np.empty((3, 4)) for i in range(a.shape[0]): for j in range(a.shape[1]):
from __future__ import print_function, division, absolute_import import numpy as np from numba import types from numba import unittest_support as unittest from numba.compiler import compile_isolated, Flags from .support import TestCase, tag looplift_flags = Flags() looplift_flags.set("enable_pyobject") looplift_flags.set("enable_looplift") pyobject_looplift_flags = looplift_flags.copy() pyobject_looplift_flags.set("enable_pyobject_looplift") def lift1(x): # Outer needs object mode because of np.empty() a = np.empty(3) for i in range(a.size): # Inner is nopython-compliant a[i] = x return a def lift2(x): # Outer needs object mode because of np.empty() a = np.empty((3, 4)) for i in range(a.shape[0]): for j in range(a.shape[1]):