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

Function _sparse_values_to_keep

tensorflow/python/training/input.py:541–546  ·  view source on GitHub ↗

Convert a per-row `keep_input` vector to a per-value one.

(t, keep_input)

Source from the content-addressed store, hash-verified

539 out_tensor.set_shape([None]) # necessary when t.ndims is unknown
540 return out_tensor
541 def _sparse_values_to_keep(t, keep_input):
542 """Convert a per-row `keep_input` vector to a per-value one."""
543 # Get the rows of every value in the sparse Tensor.
544 row_values = t.indices[:, 0]
545 # The value should be kept iff the row should be kept.
546 return array_ops.gather(keep_input, row_values)
547 if keep_input.shape.ndims == 1:
548 t = sparse_ops.sparse_retain(t, _sparse_values_to_keep(t, keep_input))
549 store_f = lambda t, name, _: _store_many_sparse(t, shared_name=name)

Callers 1

_maybe_storeFunction · 0.85

Calls 1

gatherMethod · 0.45

Tested by

no test coverage detected