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

Issue with code #2

Open
mongoose54 opened this issue Feb 18, 2019 · 2 comments
Open

Issue with code #2

mongoose54 opened this issue Feb 18, 2019 · 2 comments

Comments

@mongoose54
Copy link

Thanks for the code @LeonLIU08 !

However when running the example I am getting the following error on this part:

        padding2 = K.spatial_2d_padding(input_2,
                                        padding=(
                                            ((self.D_stride-1)/2, (self.D_stride-1)/2+1),
                                            ((self.D_stride-1)/2, (self.D_stride-1)/2+1)),
                                        data_format='channels_last')

Error: TypeError: Value passed to parameter 'paddings' has DataType float32 not in list of allowed values: int32, int64

Any suggestions?

Running the latest Keras version

@LeonLIU08
Copy link
Owner

I think this issue is caused by the auto variable format converting of python 3.
I use python 2, so when the self.D_stride is an "int", the self.D_stride/2 is also an "int", but in python 3, it will change to a float.
You may use int(.) function to convert the parameters into "int" compulsively or use "//".

@thanosvlo
Copy link

This should solve the issue
padding=(
(tf.cast((self.D_stride-1)/2,tf.int32), tf.cast((self.D_stride-1)/2+1,tf.int32)),
(tf.cast((self.D_stride-1)/2,tf.int32), tf.cast((self.D_stride-1)/2+1,tf.int32))),

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

3 participants