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
Mutablehashtable lookup support full size dynamic default values. #43269
Mutablehashtable lookup support full size dynamic default values. #43269
Conversation
This PR is required to make Hash table trainable in TensorFlow, that is a key feature for sparse weights training on Recommender System. |
Hi @rohan100jain @yuefengz , please help review this PR, Thanks! |
|
||
tf_shared_lock l(mu_); | ||
for (int64 i = 0; i < key_values.size(); ++i) { | ||
value_values(i) = gtl::FindWithDefault( | ||
table_, SubtleMustCopyIfIntegral(key_values(i)), default_val); | ||
table_, SubtleMustCopyIfIntegral(key_values(i)), | ||
is_full_default ? default_flat(i) : default_flat(0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if is_full_default == false, we expect default_total = 1 i.e. a single scalar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if is_full_default == false, we expect default_total = 1 i.e. a single scalar?
Yes, for backward compatibility, maybe you can pay attention to this change const auto default_flat = default_value.flat<V>();
The size of dynamic_default_values
will be required to be equal to self._default_value.size()
or keys.size() * self._default_value.size()
. In the latter case, we set different default values for each keys.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add comments describing this logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
cb293ec
to
9343aea
Compare
Hi @rohan100jain , thank you for your reviewing, I just push a new commit that contains test cases, clearer function comments. Please review it again, thank you very much! |
|
||
tf_shared_lock l(mu_); | ||
for (int64 i = 0; i < key_values.size(); ++i) { | ||
value_values(i) = gtl::FindWithDefault( | ||
table_, SubtleMustCopyIfIntegral(key_values(i)), default_val); | ||
table_, SubtleMustCopyIfIntegral(key_values(i)), | ||
is_full_default ? default_flat(i) : default_flat(0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add comments describing this logic.
9343aea
to
29117ee
Compare
This PR is one part of RFC:tensorflow/community#237
29117ee
to
3b11daf
Compare
…up support full size dynamic default values. This PR is one part of RFC:tensorflow/community#237
Merge pull request #43269 from rhdong:Mutablehashtable lookup support…
This PR is one part of RFC: Sparse Domain Isolation for Supporting large-scale Sparse Weights Training, and original is here : PR
@yuefengz @tanzhenyu Please review the PR, Thanks!