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

modify dropoutnet in case of batch size mismatch #505

Merged
merged 39 commits into from
Dec 10, 2024
Merged

modify dropoutnet in case of batch size mismatch #505

merged 39 commits into from
Dec 10, 2024

Conversation

yangxudong
Copy link
Collaborator

No description provided.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Draw some random uniform numbers, then check them with keep_rate. Maybe it's simpler in this way to get bernoulli numbers?

mask = tf.random.uniform(shape=(20,)) < keep_rate
mask = tf.cast(mask, tf.int32)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah! both do almost the same thing~

Copy link
Collaborator

@eric-gecheng eric-gecheng Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested on higher version of tensorflow(2.18), below statement is not working, giving some error messages, maybe due to tf and numpy compatibility issue:

import tensorflow as tf 
tf = tf.compat.v1
keep_rate = 0.2
dist = tf.distributions.Bernoulli(probs=keep_rate)
dist.sample(sample_shape=(5,))

error msg:
AttributeError: module 'numpy.core.multiarray' has no attribute 'integer'

@yangxudong yangxudong merged commit 27a8622 into master Dec 10, 2024
5 checks passed
@yangxudong yangxudong deleted the bug_fix branch December 10, 2024 02:58
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

Successfully merging this pull request may close these issues.

3 participants