From cfd0bf52094e637b516c71164761c7687e0af134 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Thu, 13 Jul 2017 16:29:01 -0700 Subject: Adding cautionary comments on the use of use_factors_weights_cache in the case where the weights are computed outside and set to the WALS object. PiperOrigin-RevId: 161882927 --- .../factorization/python/ops/factorization_ops.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tensorflow/contrib/factorization/python/ops/factorization_ops.py b/tensorflow/contrib/factorization/python/ops/factorization_ops.py index fb400dbcea..054888e734 100644 --- a/tensorflow/contrib/factorization/python/ops/factorization_ops.py +++ b/tensorflow/contrib/factorization/python/ops/factorization_ops.py @@ -229,7 +229,13 @@ class WALSModel(object): a single number or vice versa. col_weights: See row_weights. use_factors_weights_cache: When True, the factors and weights will be - cached on the workers before the updates start. Defaults to True. + cached on the workers before the updates start. Defaults to True. Note + that the weights cache is initialized through `worker_init`, and the + row/col factors cache is initialized through + `initialize_{col/row}_update_op`. In the case where the weights are + computed outside and set before the training iterations start, it is + important to ensure the `worker_init` op is run afterwards for the + weights cache to take effect. use_gramian_cache: When True, the Gramians will be cached on the workers before the updates start. Defaults to True. """ @@ -554,7 +560,14 @@ class WALSModel(object): @property def worker_init(self): - """Op to initialize worker state once before starting any updates.""" + """Op to initialize worker state once before starting any updates. + + Note that specifically this initializes the cache of the row and column + weights on workers when `use_factors_weights_cache` is True. In this case, + if these weights are being calcualted and reset after the object is created, + it is important to ensure this ops is run afterwards so the cache reflects + the correct values. + """ return self._worker_init @property -- cgit v1.2.3