Returns the value of more than one tensor variable. Arguments: tensors: list of ops to run. Returns: A list of Numpy arrays. Raises: RuntimeError: If this method is called inside defun.
(tensors)
| 3166 | |
| 3167 | @keras_export('keras.backend.batch_get_value') |
| 3168 | def batch_get_value(tensors): |
| 3169 | """Returns the value of more than one tensor variable. |
| 3170 | |
| 3171 | Arguments: |
| 3172 | tensors: list of ops to run. |
| 3173 | |
| 3174 | Returns: |
| 3175 | A list of Numpy arrays. |
| 3176 | |
| 3177 | Raises: |
| 3178 | RuntimeError: If this method is called inside defun. |
| 3179 | """ |
| 3180 | if context.executing_eagerly(): |
| 3181 | return [x.numpy() for x in tensors] |
| 3182 | elif ops.inside_function(): # pylint: disable=protected-access |
| 3183 | raise RuntimeError('Cannot get value inside Tensorflow graph function.') |
| 3184 | if tensors: |
| 3185 | return get_session(tensors).run(tensors) |
| 3186 | else: |
| 3187 | return [] |
| 3188 | |
| 3189 | |
| 3190 | @keras_export('keras.backend.set_value') |
nothing calls this directly
no test coverage detected