-
Notifications
You must be signed in to change notification settings - Fork 336
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
reduce on odd dim to any size? #119
Labels
question
Further information is requested
Comments
Hi @leoentersthevoid, def truncate_to_divisible(x, divisors):
assert len(x.shape) == len(divisors)
selection = tuple()
for axis, axis_length in enumerate(x.shape):
div = divisors[axis]
if div == 1:
selection += (slice(None, None))
else:
selection += (slice(None, axis_length // div * div))
return x[selection] and use it like this: truncate_to_divisible(x, (1, 2, 2)) |
@arogozhnikov, I see. Thanks for the reply! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Suppose an image has the following shape:
(3 561 600)
.I couldn't find a way to make it
(3 280 300)
; is there any?Sorry for this dumb question, but I really like your work, and I want to integrate it as much as possible into my projects.
All the best!
The text was updated successfully, but these errors were encountered: