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

Upsampling2d Skips one sample at index 8388608 (2^23) #19930

Closed
jrasko opened this issue Jun 27, 2024 · 2 comments
Closed

Upsampling2d Skips one sample at index 8388608 (2^23) #19930

jrasko opened this issue Jun 27, 2024 · 2 comments
Assignees
Labels

Comments

@jrasko
Copy link

jrasko commented Jun 27, 2024

When using UpSampling2D in mode "nearest", one index is skipped at exactly 8388608 (2^23). This results in a shift of all following data. See the image below:
grafik

At the end, the shape is fixed by just padding the last data:
grafik

Example Code:

import numpy as np
from keras import layers

a = np.zeros(2 ** 22 + 2)
a[1::2] = 1
up = layers.UpSampling2D(size=(2, 1))
b = up(a[None, :, None, None])
print(a[-6:].flatten())
# output: [0. 1. 0. 1. 0. 1.]
print(b[:, -6:, :, :].numpy().flatten())
# output: [1. 1. 0. 1. 1. 1.]
@jrasko
Copy link
Author

jrasko commented Jun 28, 2024

Seems like this occurs in tensorflow, but not when using the newest keras version. Therefore, it seems like this is already fixed

@jrasko jrasko closed this as not planned Won't fix, can't repro, duplicate, stale Jun 28, 2024
@mehtamansi29
Copy link
Collaborator

Hi @jrasko -

This issue is only on keras 2.15.0 but this issue doesn't reproduce in keras 3.3 and keras 3.4 latest version.

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

No branches or pull requests

2 participants