Processor for HashTable.
| 201 | |
| 202 | |
| 203 | class _HashTableProcessor(_OptimizableVariable): |
| 204 | """Processor for HashTable.""" |
| 205 | |
| 206 | def __init__(self, v): |
| 207 | self._v = v |
| 208 | |
| 209 | def target(self): |
| 210 | return self._v.handle |
| 211 | |
| 212 | def update_op(self, optimizer, g): |
| 213 | # pylint: disable=protected-access |
| 214 | if isinstance(g, ops.IndexedSlices): |
| 215 | return optimizer._hash_table_apply_sparse_duplicate_indices( |
| 216 | g.values, self._v, g.indices) |
| 217 | else: |
| 218 | raise RuntimeError("HashTable grad should be Sparse not Dense") |
| 219 | |
| 220 | |
| 221 | class _TensorProcessor(_OptimizableVariable): |