Why does ordering of dependent numba jitt'ed functions matter?What is the difference between contiguous and non-contiguous arrays?Numba - How to fill 2D array in parallelWhy does comparing strings using either '==' or 'is' sometimes produce a different result?Creating a singleton in PythonWhy does Python code run faster in a function?numba error when using scipy.specialHow to specify function signature for a method using custom types in numbaHow to call ctypes functions that use pointer to return value in Numba @jitFastest way to compute a factorial in a numba nopython functionCompare strings in numba-compiled functionNumpy attributes not recognized in NumbaLinear Combinations of Numba jitted functions in nopython mode
I reverse the source code, you negate the input!
Manager manipulates my leaves, what's in it for him?
US entry with tourist visa but past alcohol arrest
The 100 soldier problem
Would Taiwan and China's dispute be solved if Taiwan gave up being the Republic of China?
Is there a connection between IT and Ghostbusters?
Automate tasks with Lambdas in java
What do solvers like Gurobi and CPLEX do when they run into hard instances of MIP
Resolving moral conflict
Applications of mathematics in clinical setting
As an employer, can I compel my employees to vote?
Removing rows containing NA in every column
Writing a letter of recommendation for a mediocre student
How to ask a man to not take up more than one seat on public transport while avoiding conflict?
Why are Fuji lenses more expensive than others?
How can I prevent soul energy from dissipating?
Do the villains know Batman has no superpowers?
Can one guy with a duplicator initiate a nuclear apocalypse?
Can Northern Ireland's border issue be solved by repartition?
Temporarily moving a SQL Server 2016 database to SQL Server 2017 and then moving back. Is it possible?
What can a pilot do, if an air traffic controller is incapacitated?
What was the deeper meaning of Hermione wanting the cloak?
C# Fastest way to do Array Table Lookup with Integer Index
Shimano 105 FD-R7000-F front dereailleur chain rub
Why does ordering of dependent numba jitt'ed functions matter?
What is the difference between contiguous and non-contiguous arrays?Numba - How to fill 2D array in parallelWhy does comparing strings using either '==' or 'is' sometimes produce a different result?Creating a singleton in PythonWhy does Python code run faster in a function?numba error when using scipy.specialHow to specify function signature for a method using custom types in numbaHow to call ctypes functions that use pointer to return value in Numba @jitFastest way to compute a factorial in a numba nopython functionCompare strings in numba-compiled functionNumpy attributes not recognized in NumbaLinear Combinations of Numba jitted functions in nopython mode
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
In python you can define multiple functions that call each other in any order, and at runtime the functions will be called on. The order that these functions are defined in a script doesn't matter, once they exist. For example, the below is valid and will work
import numpy as np
def func1(arr):
out = np.empty_like(arr)
for i in range(arr.shape[0]):
out[i] = func2(arr[i]) # calling func2 here which is defined below
return out
def func2(a):
out = a + 1
return out
func1 can call on func2 even though func2 is defined after func1.
However, if I decorate these functions with numba, I get an error
import numpy as np
import numba as nb
@nb.jit("f8[:](f8[:])", nopython=True)
def func1(arr):
out = np.empty_like(arr)
for i in range(arr.shape[0]):
out[i] = func2(arr[i])
return out
@nb.jit("f8(f8)", nopython=True)
def func2(a):
out = a + 1
return out
>>> TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Untyped global name 'func2': cannot determine Numba type of <class
'numba.ir.UndefinedType'>
So numba doesn't know what func2 is when compiling func1 using JIT. Simply switching the order of these functions works though, so that func2 comes before func1
@nb.jit("f8(f8)", nopython=True)
def func2(a):
out = a + 1
return out
@nb.jit("f8[:](f8[:])", nopython=True)
def func1(arr):
out = np.empty_like(arr)
for i in range(arr.shape[0]):
out[i] = func2(arr[i])
return out
Why is this? I have a feeling the pure python mode works because python is dynamically typed and not compiled, whereas numba, using JIT, by definition does compile the functions (and maybe therefore needs perfect knowledge of everything that happens within every function?). But I don't understand why numba doesn't search within the scope for all functions if it comes across a function it hasn't seen.
python jit numba
add a comment
|
In python you can define multiple functions that call each other in any order, and at runtime the functions will be called on. The order that these functions are defined in a script doesn't matter, once they exist. For example, the below is valid and will work
import numpy as np
def func1(arr):
out = np.empty_like(arr)
for i in range(arr.shape[0]):
out[i] = func2(arr[i]) # calling func2 here which is defined below
return out
def func2(a):
out = a + 1
return out
func1 can call on func2 even though func2 is defined after func1.
However, if I decorate these functions with numba, I get an error
import numpy as np
import numba as nb
@nb.jit("f8[:](f8[:])", nopython=True)
def func1(arr):
out = np.empty_like(arr)
for i in range(arr.shape[0]):
out[i] = func2(arr[i])
return out
@nb.jit("f8(f8)", nopython=True)
def func2(a):
out = a + 1
return out
>>> TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Untyped global name 'func2': cannot determine Numba type of <class
'numba.ir.UndefinedType'>
So numba doesn't know what func2 is when compiling func1 using JIT. Simply switching the order of these functions works though, so that func2 comes before func1
@nb.jit("f8(f8)", nopython=True)
def func2(a):
out = a + 1
return out
@nb.jit("f8[:](f8[:])", nopython=True)
def func1(arr):
out = np.empty_like(arr)
for i in range(arr.shape[0]):
out[i] = func2(arr[i])
return out
Why is this? I have a feeling the pure python mode works because python is dynamically typed and not compiled, whereas numba, using JIT, by definition does compile the functions (and maybe therefore needs perfect knowledge of everything that happens within every function?). But I don't understand why numba doesn't search within the scope for all functions if it comes across a function it hasn't seen.
python jit numba
add a comment
|
In python you can define multiple functions that call each other in any order, and at runtime the functions will be called on. The order that these functions are defined in a script doesn't matter, once they exist. For example, the below is valid and will work
import numpy as np
def func1(arr):
out = np.empty_like(arr)
for i in range(arr.shape[0]):
out[i] = func2(arr[i]) # calling func2 here which is defined below
return out
def func2(a):
out = a + 1
return out
func1 can call on func2 even though func2 is defined after func1.
However, if I decorate these functions with numba, I get an error
import numpy as np
import numba as nb
@nb.jit("f8[:](f8[:])", nopython=True)
def func1(arr):
out = np.empty_like(arr)
for i in range(arr.shape[0]):
out[i] = func2(arr[i])
return out
@nb.jit("f8(f8)", nopython=True)
def func2(a):
out = a + 1
return out
>>> TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Untyped global name 'func2': cannot determine Numba type of <class
'numba.ir.UndefinedType'>
So numba doesn't know what func2 is when compiling func1 using JIT. Simply switching the order of these functions works though, so that func2 comes before func1
@nb.jit("f8(f8)", nopython=True)
def func2(a):
out = a + 1
return out
@nb.jit("f8[:](f8[:])", nopython=True)
def func1(arr):
out = np.empty_like(arr)
for i in range(arr.shape[0]):
out[i] = func2(arr[i])
return out
Why is this? I have a feeling the pure python mode works because python is dynamically typed and not compiled, whereas numba, using JIT, by definition does compile the functions (and maybe therefore needs perfect knowledge of everything that happens within every function?). But I don't understand why numba doesn't search within the scope for all functions if it comes across a function it hasn't seen.
python jit numba
In python you can define multiple functions that call each other in any order, and at runtime the functions will be called on. The order that these functions are defined in a script doesn't matter, once they exist. For example, the below is valid and will work
import numpy as np
def func1(arr):
out = np.empty_like(arr)
for i in range(arr.shape[0]):
out[i] = func2(arr[i]) # calling func2 here which is defined below
return out
def func2(a):
out = a + 1
return out
func1 can call on func2 even though func2 is defined after func1.
However, if I decorate these functions with numba, I get an error
import numpy as np
import numba as nb
@nb.jit("f8[:](f8[:])", nopython=True)
def func1(arr):
out = np.empty_like(arr)
for i in range(arr.shape[0]):
out[i] = func2(arr[i])
return out
@nb.jit("f8(f8)", nopython=True)
def func2(a):
out = a + 1
return out
>>> TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Untyped global name 'func2': cannot determine Numba type of <class
'numba.ir.UndefinedType'>
So numba doesn't know what func2 is when compiling func1 using JIT. Simply switching the order of these functions works though, so that func2 comes before func1
@nb.jit("f8(f8)", nopython=True)
def func2(a):
out = a + 1
return out
@nb.jit("f8[:](f8[:])", nopython=True)
def func1(arr):
out = np.empty_like(arr)
for i in range(arr.shape[0]):
out[i] = func2(arr[i])
return out
Why is this? I have a feeling the pure python mode works because python is dynamically typed and not compiled, whereas numba, using JIT, by definition does compile the functions (and maybe therefore needs perfect knowledge of everything that happens within every function?). But I don't understand why numba doesn't search within the scope for all functions if it comes across a function it hasn't seen.
python jit numba
python jit numba
asked Mar 28 at 14:30
PyRsquaredPyRsquared
1,9892 gold badges22 silver badges36 bronze badges
1,9892 gold badges22 silver badges36 bronze badges
add a comment
|
add a comment
|
1 Answer
1
active
oldest
votes
Short version - delete the "f8[:](f8[:])"
Your intuition is right. Python functions are looked up at call time, which is why they can be defined out of order. Looking at the python bytecode with a dis (disassembly) module make this clear - the name b is looked up as a global each time function a is called.
def a():
return b()
def b():
return 2
import dis
dis.dis(a)
# 2 0 LOAD_GLOBAL 0 (b)
# 2 CALL_FUNCTION 0
# 4 RETURN_VALUE
In nopython mode, numba needs to statically know the address of each function that is being called - this makes the code fast (no longer doing a runtime lookup), and also opens the door to other optimizations, like inlining.
That said, numba can handle this case. By specifying the type signature ("f8[:](f8[:])"), you are forcing ahead of time compilation. Omit it, and a number will defer to the first function call it and it will work.
Thanks for the explanation. I did notice that by omitting the signature (but still decorating the function with jit) seemed to work. However for my use case I'll leave the signature because I want to get the proper error messages incase some incorrect type is passed to the function before I start operating on it. Thanks again!
– PyRsquared
Mar 28 at 20:22
1
@PyRsquared Please note also that explicitly declaring non contiguous arrays [:] usually prevents SIMD-vectorization and can lead to slower runtimes (just replaceout = a + 1byout = np.sin(a)to see a quite noticeable effect. But if you explicitly declare contiguous arrays [::1] the function won't work on non-contigous arrays anymore....
– max9111
Mar 29 at 8:20
@max9111 Excellent observation, thanks! So in this case here, for optimal performance (using SIMD), you suggest usingf[::1]? I'm not entirely sure how numpy arrays are stored in memory, but for 1D case surely they are contiguous?
– PyRsquared
Mar 29 at 10:40
1
@PyRsquared You can check this things with ndarray.flags (eg. A=B[0:-1:2] -> A is a non contiguous view on B). Well you have to choose it. If it is OK for you limit the function to contiguous arrays... Another possibility is to use np.ascontiguousarray, but this has the downside of copying an array. Sometimes you want to explicitly create a contiguous copy eg. stackoverflow.com/a/55405644/4045774, sometimes not. It depends on the algorithm...
– max9111
Mar 29 at 14:01
add a comment
|
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55400141%2fwhy-does-ordering-of-dependent-numba-jitted-functions-matter%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Short version - delete the "f8[:](f8[:])"
Your intuition is right. Python functions are looked up at call time, which is why they can be defined out of order. Looking at the python bytecode with a dis (disassembly) module make this clear - the name b is looked up as a global each time function a is called.
def a():
return b()
def b():
return 2
import dis
dis.dis(a)
# 2 0 LOAD_GLOBAL 0 (b)
# 2 CALL_FUNCTION 0
# 4 RETURN_VALUE
In nopython mode, numba needs to statically know the address of each function that is being called - this makes the code fast (no longer doing a runtime lookup), and also opens the door to other optimizations, like inlining.
That said, numba can handle this case. By specifying the type signature ("f8[:](f8[:])"), you are forcing ahead of time compilation. Omit it, and a number will defer to the first function call it and it will work.
Thanks for the explanation. I did notice that by omitting the signature (but still decorating the function with jit) seemed to work. However for my use case I'll leave the signature because I want to get the proper error messages incase some incorrect type is passed to the function before I start operating on it. Thanks again!
– PyRsquared
Mar 28 at 20:22
1
@PyRsquared Please note also that explicitly declaring non contiguous arrays [:] usually prevents SIMD-vectorization and can lead to slower runtimes (just replaceout = a + 1byout = np.sin(a)to see a quite noticeable effect. But if you explicitly declare contiguous arrays [::1] the function won't work on non-contigous arrays anymore....
– max9111
Mar 29 at 8:20
@max9111 Excellent observation, thanks! So in this case here, for optimal performance (using SIMD), you suggest usingf[::1]? I'm not entirely sure how numpy arrays are stored in memory, but for 1D case surely they are contiguous?
– PyRsquared
Mar 29 at 10:40
1
@PyRsquared You can check this things with ndarray.flags (eg. A=B[0:-1:2] -> A is a non contiguous view on B). Well you have to choose it. If it is OK for you limit the function to contiguous arrays... Another possibility is to use np.ascontiguousarray, but this has the downside of copying an array. Sometimes you want to explicitly create a contiguous copy eg. stackoverflow.com/a/55405644/4045774, sometimes not. It depends on the algorithm...
– max9111
Mar 29 at 14:01
add a comment
|
Short version - delete the "f8[:](f8[:])"
Your intuition is right. Python functions are looked up at call time, which is why they can be defined out of order. Looking at the python bytecode with a dis (disassembly) module make this clear - the name b is looked up as a global each time function a is called.
def a():
return b()
def b():
return 2
import dis
dis.dis(a)
# 2 0 LOAD_GLOBAL 0 (b)
# 2 CALL_FUNCTION 0
# 4 RETURN_VALUE
In nopython mode, numba needs to statically know the address of each function that is being called - this makes the code fast (no longer doing a runtime lookup), and also opens the door to other optimizations, like inlining.
That said, numba can handle this case. By specifying the type signature ("f8[:](f8[:])"), you are forcing ahead of time compilation. Omit it, and a number will defer to the first function call it and it will work.
Thanks for the explanation. I did notice that by omitting the signature (but still decorating the function with jit) seemed to work. However for my use case I'll leave the signature because I want to get the proper error messages incase some incorrect type is passed to the function before I start operating on it. Thanks again!
– PyRsquared
Mar 28 at 20:22
1
@PyRsquared Please note also that explicitly declaring non contiguous arrays [:] usually prevents SIMD-vectorization and can lead to slower runtimes (just replaceout = a + 1byout = np.sin(a)to see a quite noticeable effect. But if you explicitly declare contiguous arrays [::1] the function won't work on non-contigous arrays anymore....
– max9111
Mar 29 at 8:20
@max9111 Excellent observation, thanks! So in this case here, for optimal performance (using SIMD), you suggest usingf[::1]? I'm not entirely sure how numpy arrays are stored in memory, but for 1D case surely they are contiguous?
– PyRsquared
Mar 29 at 10:40
1
@PyRsquared You can check this things with ndarray.flags (eg. A=B[0:-1:2] -> A is a non contiguous view on B). Well you have to choose it. If it is OK for you limit the function to contiguous arrays... Another possibility is to use np.ascontiguousarray, but this has the downside of copying an array. Sometimes you want to explicitly create a contiguous copy eg. stackoverflow.com/a/55405644/4045774, sometimes not. It depends on the algorithm...
– max9111
Mar 29 at 14:01
add a comment
|
Short version - delete the "f8[:](f8[:])"
Your intuition is right. Python functions are looked up at call time, which is why they can be defined out of order. Looking at the python bytecode with a dis (disassembly) module make this clear - the name b is looked up as a global each time function a is called.
def a():
return b()
def b():
return 2
import dis
dis.dis(a)
# 2 0 LOAD_GLOBAL 0 (b)
# 2 CALL_FUNCTION 0
# 4 RETURN_VALUE
In nopython mode, numba needs to statically know the address of each function that is being called - this makes the code fast (no longer doing a runtime lookup), and also opens the door to other optimizations, like inlining.
That said, numba can handle this case. By specifying the type signature ("f8[:](f8[:])"), you are forcing ahead of time compilation. Omit it, and a number will defer to the first function call it and it will work.
Short version - delete the "f8[:](f8[:])"
Your intuition is right. Python functions are looked up at call time, which is why they can be defined out of order. Looking at the python bytecode with a dis (disassembly) module make this clear - the name b is looked up as a global each time function a is called.
def a():
return b()
def b():
return 2
import dis
dis.dis(a)
# 2 0 LOAD_GLOBAL 0 (b)
# 2 CALL_FUNCTION 0
# 4 RETURN_VALUE
In nopython mode, numba needs to statically know the address of each function that is being called - this makes the code fast (no longer doing a runtime lookup), and also opens the door to other optimizations, like inlining.
That said, numba can handle this case. By specifying the type signature ("f8[:](f8[:])"), you are forcing ahead of time compilation. Omit it, and a number will defer to the first function call it and it will work.
answered Mar 28 at 18:25
chrisbchrisb
28k7 gold badges42 silver badges45 bronze badges
28k7 gold badges42 silver badges45 bronze badges
Thanks for the explanation. I did notice that by omitting the signature (but still decorating the function with jit) seemed to work. However for my use case I'll leave the signature because I want to get the proper error messages incase some incorrect type is passed to the function before I start operating on it. Thanks again!
– PyRsquared
Mar 28 at 20:22
1
@PyRsquared Please note also that explicitly declaring non contiguous arrays [:] usually prevents SIMD-vectorization and can lead to slower runtimes (just replaceout = a + 1byout = np.sin(a)to see a quite noticeable effect. But if you explicitly declare contiguous arrays [::1] the function won't work on non-contigous arrays anymore....
– max9111
Mar 29 at 8:20
@max9111 Excellent observation, thanks! So in this case here, for optimal performance (using SIMD), you suggest usingf[::1]? I'm not entirely sure how numpy arrays are stored in memory, but for 1D case surely they are contiguous?
– PyRsquared
Mar 29 at 10:40
1
@PyRsquared You can check this things with ndarray.flags (eg. A=B[0:-1:2] -> A is a non contiguous view on B). Well you have to choose it. If it is OK for you limit the function to contiguous arrays... Another possibility is to use np.ascontiguousarray, but this has the downside of copying an array. Sometimes you want to explicitly create a contiguous copy eg. stackoverflow.com/a/55405644/4045774, sometimes not. It depends on the algorithm...
– max9111
Mar 29 at 14:01
add a comment
|
Thanks for the explanation. I did notice that by omitting the signature (but still decorating the function with jit) seemed to work. However for my use case I'll leave the signature because I want to get the proper error messages incase some incorrect type is passed to the function before I start operating on it. Thanks again!
– PyRsquared
Mar 28 at 20:22
1
@PyRsquared Please note also that explicitly declaring non contiguous arrays [:] usually prevents SIMD-vectorization and can lead to slower runtimes (just replaceout = a + 1byout = np.sin(a)to see a quite noticeable effect. But if you explicitly declare contiguous arrays [::1] the function won't work on non-contigous arrays anymore....
– max9111
Mar 29 at 8:20
@max9111 Excellent observation, thanks! So in this case here, for optimal performance (using SIMD), you suggest usingf[::1]? I'm not entirely sure how numpy arrays are stored in memory, but for 1D case surely they are contiguous?
– PyRsquared
Mar 29 at 10:40
1
@PyRsquared You can check this things with ndarray.flags (eg. A=B[0:-1:2] -> A is a non contiguous view on B). Well you have to choose it. If it is OK for you limit the function to contiguous arrays... Another possibility is to use np.ascontiguousarray, but this has the downside of copying an array. Sometimes you want to explicitly create a contiguous copy eg. stackoverflow.com/a/55405644/4045774, sometimes not. It depends on the algorithm...
– max9111
Mar 29 at 14:01
Thanks for the explanation. I did notice that by omitting the signature (but still decorating the function with jit) seemed to work. However for my use case I'll leave the signature because I want to get the proper error messages incase some incorrect type is passed to the function before I start operating on it. Thanks again!
– PyRsquared
Mar 28 at 20:22
Thanks for the explanation. I did notice that by omitting the signature (but still decorating the function with jit) seemed to work. However for my use case I'll leave the signature because I want to get the proper error messages incase some incorrect type is passed to the function before I start operating on it. Thanks again!
– PyRsquared
Mar 28 at 20:22
1
1
@PyRsquared Please note also that explicitly declaring non contiguous arrays [:] usually prevents SIMD-vectorization and can lead to slower runtimes (just replace
out = a + 1 by out = np.sin(a) to see a quite noticeable effect. But if you explicitly declare contiguous arrays [::1] the function won't work on non-contigous arrays anymore....– max9111
Mar 29 at 8:20
@PyRsquared Please note also that explicitly declaring non contiguous arrays [:] usually prevents SIMD-vectorization and can lead to slower runtimes (just replace
out = a + 1 by out = np.sin(a) to see a quite noticeable effect. But if you explicitly declare contiguous arrays [::1] the function won't work on non-contigous arrays anymore....– max9111
Mar 29 at 8:20
@max9111 Excellent observation, thanks! So in this case here, for optimal performance (using SIMD), you suggest using
f[::1] ? I'm not entirely sure how numpy arrays are stored in memory, but for 1D case surely they are contiguous?– PyRsquared
Mar 29 at 10:40
@max9111 Excellent observation, thanks! So in this case here, for optimal performance (using SIMD), you suggest using
f[::1] ? I'm not entirely sure how numpy arrays are stored in memory, but for 1D case surely they are contiguous?– PyRsquared
Mar 29 at 10:40
1
1
@PyRsquared You can check this things with ndarray.flags (eg. A=B[0:-1:2] -> A is a non contiguous view on B). Well you have to choose it. If it is OK for you limit the function to contiguous arrays... Another possibility is to use np.ascontiguousarray, but this has the downside of copying an array. Sometimes you want to explicitly create a contiguous copy eg. stackoverflow.com/a/55405644/4045774, sometimes not. It depends on the algorithm...
– max9111
Mar 29 at 14:01
@PyRsquared You can check this things with ndarray.flags (eg. A=B[0:-1:2] -> A is a non contiguous view on B). Well you have to choose it. If it is OK for you limit the function to contiguous arrays... Another possibility is to use np.ascontiguousarray, but this has the downside of copying an array. Sometimes you want to explicitly create a contiguous copy eg. stackoverflow.com/a/55405644/4045774, sometimes not. It depends on the algorithm...
– max9111
Mar 29 at 14:01
add a comment
|
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55400141%2fwhy-does-ordering-of-dependent-numba-jitted-functions-matter%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown