Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1271)

Unified Diff: appengine/findit/libs/math/vectors.py

Issue 2625073003: [Predator] Add MetaWeight and MetaFeatureValue to group multiple weights and features together. (Closed)
Patch Set: Rebase. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/findit/libs/math/test/vectors_test.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/libs/math/vectors.py
diff --git a/appengine/findit/libs/math/vectors.py b/appengine/findit/libs/math/vectors.py
index e2ac81f7ed9250516b25731882dd603a585fe2fa..51622d15db5e162a5247e63bef2399070bacc50f 100644
--- a/appengine/findit/libs/math/vectors.py
+++ b/appengine/findit/libs/math/vectors.py
@@ -36,7 +36,11 @@ def vsum(vs, shape=None):
total = np.zeros(shape)
it = np.nditer(total, flags=['multi_index'], op_flags=['writeonly'])
while not it.finished:
- it[0] = math.fsum(v[it.multi_index] for v in vs)
+ try:
+ it[0] = math.fsum(v[it.multi_index] for v in vs)
+ except TypeError:
+ it[0] = sum(v[it.multi_index] for v in vs)
+
it.iternext()
return total
« no previous file with comments | « appengine/findit/libs/math/test/vectors_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698