Processor for ordinary Tensors. Even though a Tensor can't really be updated, sometimes it is useful to compute the gradients with respect to a Tensor using the optimizer. Updating the Tensor is, of course, unsupported.
| 219 | |
| 220 | |
| 221 | class _TensorProcessor(_OptimizableVariable): |
| 222 | """Processor for ordinary Tensors. |
| 223 | |
| 224 | Even though a Tensor can't really be updated, sometimes it is useful to |
| 225 | compute the gradients with respect to a Tensor using the optimizer. Updating |
| 226 | the Tensor is, of course, unsupported. |
| 227 | """ |
| 228 | |
| 229 | def __init__(self, v): |
| 230 | self._v = v |
| 231 | |
| 232 | def target(self): |
| 233 | return self._v |
| 234 | |
| 235 | def update_op(self, optimizer, g): |
| 236 | raise NotImplementedError("Trying to update a Tensor ", self._v) |
| 237 | |
| 238 | |
| 239 | def _get_processor(v): |