def concatenate3(arrays):
 arrays = concrete(arrays)
 ndim = ndimlist(arrays)
 if (not ndim):
  return arrays
 if (not arrays):
  return np.empty(0)
 chunks = chunks_from_arrays(arrays)
 shape = tuple(map(sum, chunks))
 def dtype(x):
  try:
   return x.dtype
  except AttributeError:
   return type(x)
 result = np.empty(shape=shape, dtype=dtype(deepfirst(arrays)))
 for (idx, arr) in zip(slices_from_chunks(chunks), core.flatten(arrays)):
  if hasattr(arr, 'ndim'):
   while (arr.ndim < ndim):
    arr = arr[None, ...]
  result[idx] = arr
 return result

def concatenate3 ( arrays ) : arrays = concrete ( arrays ) ndim = ndimlist ( arrays ) if ( not ndim ) : return arrays if ( not arrays ) : return np . empty ( 0 ) chunks = chunks_from_arrays ( arrays ) shape = tuple ( map ( sum , chunks ) ) def dtype ( x ) : try : return x . dtype except AttributeError : return type ( x ) result = np . empty ( shape = shape , dtype = dtype ( deepfirst ( arrays ) ) ) for ( idx , arr ) in zip ( slices_from_chunks ( chunks ) , core . flatten ( arrays ) ) : if hasattr ( arr , 'ndim' ) : while ( arr . ndim < ndim ) : arr = arr [ None , ... ] result [ idx ] = arr return result
recursive np .