MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Generate

Method Generate

tensorflow/core/kernels/sparse_cross_op.cc:200–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198 : columns_(columns), num_buckets_(num_buckets), hash_key_(hash_key) {}
199
200 int64 Generate(const int64 batch_index,
201 const std::vector<int>& permutation) const {
202 // Do the fingerprint concatenation on uint64.
203 uint64 hashed_output = hash_key_;
204 for (size_t i = 0; i < permutation.size(); ++i) {
205 uint64 hash_i = columns_[i]->Feature(batch_index, permutation[i]);
206 hashed_output = FingerprintCat64(hashed_output, hash_i);
207 }
208 // The return value is int64 based on the number of buckets.
209 if (num_buckets_ > 0) {
210 return hashed_output % num_buckets_;
211 } else {
212 // To prevent negative output we take modulo to max int64.
213 return hashed_output % std::numeric_limits<int64>::max();
214 }
215 }
216
217 private:
218 const std::vector<std::unique_ptr<ColumnInterface<int64>>>& columns_;

Callers 1

ComputeMethod · 0.45

Calls 4

FingerprintCat64Function · 0.85
maxFunction · 0.50
sizeMethod · 0.45
FeatureMethod · 0.45

Tested by

no test coverage detected