The Wayback Machine - https://web.archive.org/web/20201129210416/https://github.com/tensorlayer/tensorlayer/issues/1098
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

Spatial Transformer not working #1098

Open
gergopool opened this issue Aug 5, 2020 · 1 comment
Open

Spatial Transformer not working #1098

gergopool opened this issue Aug 5, 2020 · 1 comment

Comments

@gergopool
Copy link

@gergopool gergopool commented Aug 5, 2020

New Issue Checklist

Issue Description

I was intended to use your SpatialTransformer layer, but it just doesn't work (tensorflow 2.3).
First my problem was that the SpatialTransformer2dAffine/forward function returned with a tensor with wrong shape (including Nones), but it could be fixed by changing the line

batch_size = theta_input.shape[0]

to

batch_size = tf.shape(theta_input)[0]

After I fixed this, the python interpreter stopped at tensorlayer.layers.core.Layer/_add_node, because the tensor objects have no _info attribute.

Can you please double-check if your spatial transformer works as intended under tf2? Thanks. ^^

@Laicheng0830
Copy link
Member

@Laicheng0830 Laicheng0830 commented Aug 6, 2020

' object has no attribute '_info'. check your inputs, the input needs to be Layer;
For Your Information:

    from tensorlayer.layers import Input, Flatten, Dense
    ni = Input([32, 40, 40, 1])
    nn = Flatten()(ni)
    nn = Dense(n_units=20, act=tf.nn.tanh)(nn)
    stn = SpatialTransformer2dAffine(out_size=(20, 20), in_channels=20)
    nn = stn((nn, ni))
    print(nn)`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.