taichi equivalent of numpy.sum #8358
Unanswered
Archana2016
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have been trying taichi to improve the speed of heavily looped numpy based calculations. I am happy with the speed, but stuck in simple operations.
I cannot find a simple way to sum up all elements of the following taichi field
CON = ti.field(ti.f32, shape=(M,N,O))
I am looking for something like numpy.sum(CON) without having to loop over M,N,O dimensions
Also I would like to know how to multiple all elements of CON with a constant. For example,
CON = ti.field(ti.f32, shape=(M,N,O))
x = 0.5
CON = CON*x # but this throws a taichi scope error
Your suggestions are greatly appreciated
Archana
Beta Was this translation helpful? Give feedback.
All reactions