MCPcopy Create free account
hub / github.com/numpy/numpy / _create_arrays

Function _create_arrays

numpy/lib/function_base.py:2101–2114  ·  view source on GitHub ↗

Helper for creating output arrays in vectorize.

(broadcast_shape, dim_sizes, list_of_core_dims, dtypes,
                   results=None)

Source from the content-addressed store, hash-verified

2099
2100
2101def _create_arrays(broadcast_shape, dim_sizes, list_of_core_dims, dtypes,
2102 results=None):
2103 """Helper for creating output arrays in vectorize."""
2104 shapes = _calculate_shapes(broadcast_shape, dim_sizes, list_of_core_dims)
2105 if dtypes is None:
2106 dtypes = [None] * len(shapes)
2107 if results is None:
2108 arrays = tuple(np.empty(shape=shape, dtype=dtype)
2109 for shape, dtype in zip(shapes, dtypes))
2110 else:
2111 arrays = tuple(np.empty_like(result, shape=shape, dtype=dtype)
2112 for result, shape, dtype
2113 in zip(results, shapes, dtypes))
2114 return arrays
2115
2116
2117@set_module('numpy')

Callers 1

Calls 1

_calculate_shapesFunction · 0.85

Tested by

no test coverage detected