def chunks_from_arrays(arrays):
 if (not arrays):
  return ()
 result = []
 dim = 0
 def shape(x):
  try:
   return x.shape
  except AttributeError:
   return (1,)
 while isinstance(arrays, (list, tuple)):
  result.append(tuple((shape(deepfirst(a))[dim] for a in arrays)))
  arrays = arrays[0]
  dim += 1
 return tuple(result)

def chunks_from_arrays ( arrays ) : if ( not arrays ) : return ( ) result = [ ] dim = 0 def shape ( x ) : try : return x . shape except AttributeError : return ( 1 , ) while isinstance ( arrays , ( list , tuple ) ) : result . append ( tuple ( ( shape ( deepfirst ( a ) ) [ dim ] for a in arrays ) ) ) arrays = arrays [ 0 ] dim += 1 return tuple ( result )
chunks tuple from nested list of arrays .