Handle out parameters If out is a dask.array then this overwrites the contents of that array with the result
(out, result)
| 5244 | |
| 5245 | |
| 5246 | def handle_out(out, result): |
| 5247 | """Handle out parameters |
| 5248 | |
| 5249 | If out is a dask.array then this overwrites the contents of that array with |
| 5250 | the result |
| 5251 | """ |
| 5252 | out = _elemwise_normalize_out(out) |
| 5253 | if isinstance(out, Array): |
| 5254 | if out.shape != result.shape: |
| 5255 | raise ValueError( |
| 5256 | "Mismatched shapes between result and out parameter. " |
| 5257 | f"out={out.shape}, result={result.shape}" |
| 5258 | ) |
| 5259 | out._chunks = result.chunks |
| 5260 | out.dask = result.dask |
| 5261 | out._meta = result._meta |
| 5262 | out._name = result.name |
| 5263 | return out |
| 5264 | else: |
| 5265 | return result |
| 5266 | |
| 5267 | |
| 5268 | def _enforce_dtype(*args, **kwargs): |
no test coverage detected
searching dependent graphs…