Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reduction functions failed when reduction_indices is numpy.int32 #21

Closed
ugtony opened this issue Dec 23, 2016 · 1 comment
Closed

reduction functions failed when reduction_indices is numpy.int32 #21

ugtony opened this issue Dec 23, 2016 · 1 comment

Comments

@ugtony
Copy link

ugtony commented Dec 23, 2016

When running the tfdeploy model, I got this error

File "/home/sutony/git/facenet/src/align/tfdeploy.py", line 1838, in Max
axis=tuple(reduction_indices)
TypeError: 'numpy.int32' object is not iterable

It happens when the reduction_indices is an integer

#does not work when reduction_indices is an numpy integer (e.g., np.int32)
tuple(reduction_indices)  

I changed the code in Max() and Sum() to make the program runnable, but the code is not neat and I'm not sure if it works for other cases.

if not isinstance(reduction_indices, np.ndarray):
    return np.amax(a, axis=reduction_indices, keepdims=keep_dims),
else:
    return np.amax(a, axis=tuple(reduction_indices), keepdims=keep_dims),

The other reduction functions might cause the same error.

@riga riga closed this as completed in aead7cf Dec 23, 2016
@riga
Copy link
Owner

riga commented Dec 23, 2016

Thanks for reporting this.

The isinstance query cannot be avoided imho to ensure the interface between tf and np is working in all situations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants