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

Method UpdateDenseDeltaWeights

tensorflow/core/kernels/sdca_internal.cc:39–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37using UnalignedInt64Vector = TTypes<const int64>::UnalignedConstVec;
38
39void FeatureWeightsDenseStorage::UpdateDenseDeltaWeights(
40 const Eigen::ThreadPoolDevice& device,
41 const Example::DenseVector& dense_vector,
42 const std::vector<double>& normalized_bounded_dual_delta) {
43 const size_t num_weight_vectors = normalized_bounded_dual_delta.size();
44 if (num_weight_vectors == 1) {
45 deltas_.device(device) =
46 deltas_ + dense_vector.RowAsMatrix() *
47 deltas_.constant(normalized_bounded_dual_delta[0]);
48 } else {
49 // Transform the dual vector into a column matrix.
50 const Eigen::TensorMap<Eigen::Tensor<const double, 2, Eigen::RowMajor>>
51 dual_matrix(normalized_bounded_dual_delta.data(), num_weight_vectors,
52 1);
53 const Eigen::array<Eigen::IndexPair<int>, 1> product_dims = {
54 Eigen::IndexPair<int>(1, 0)};
55 // This computes delta_w += delta_vector / \lamdba * N.
56 deltas_.device(device) =
57 (deltas_.cast<double>() +
58 dual_matrix.contract(dense_vector.RowAsMatrix().cast<double>(),
59 product_dims))
60 .cast<float>();
61 }
62}
63
64void FeatureWeightsSparseStorage::UpdateSparseDeltaWeights(
65 const Eigen::ThreadPoolDevice& device,

Callers 1

UpdateDeltaWeightsMethod · 0.80

Calls 5

RowAsMatrixMethod · 0.80
sizeMethod · 0.45
deviceMethod · 0.45
constantMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected