@dispatch(Expr, Mapping)
def compute(expr, d, return_type=no_default, **kwargs):
 _reset_leaves()
 optimize_ = kwargs.get('optimize', optimize)
 pre_compute_ = kwargs.get('pre_compute', pre_compute)
 post_compute_ = kwargs.get('post_compute', post_compute)
 (expr2, d2) = swap_resources_into_scope(expr, d)
 if pre_compute_:
  d3 = dict(((e, pre_compute_(e, dat, **kwargs)) for (e, dat) in d2.items() if (e in expr2)))
 else:
  d3 = d2
 if optimize_:
  try:
   expr3 = optimize_(expr2, *[v for (e, v) in d3.items() if (e in expr2)])
   _d = dict(zip(expr2._leaves(), expr3._leaves()))
   d4 = dict(((e._subs(_d), d) for (e, d) in d3.items()))
  except NotImplementedError:
   expr3 = expr2
   d4 = d3
 else:
  expr3 = expr2
  d4 = d3
 result = top_then_bottom_then_top_again_etc(expr3, d4, **kwargs)
 if post_compute_:
  result = post_compute_(expr3, result, scope=d4)
 if (return_type is no_default):
  msg = "The default behavior of compute will change in version >= 0.11 where the `return_type` parameter will default to 'core'."
  warnings.warn(msg, DeprecationWarning)
 elif (return_type == 'core'):
  result = coerce_core(result, expr.dshape)
 elif isinstance(return_type, type):
  result = into(return_type, result, dshape=expr3.dshape)
 elif (return_type != 'native'):
  raise ValueError('Invalid return_type passed to compute: {}'.format(return_type))
 return result

@ dispatch ( Expr , Mapping ) def compute ( expr , d , return_type = no_default , ** kwargs ) : _reset_leaves ( ) optimize_ = kwargs . get ( 'optimize' , optimize ) pre_compute_ = kwargs . get ( 'pre_compute' , pre_compute ) post_compute_ = kwargs . get ( 'post_compute' , post_compute ) ( expr2 , d2 ) = swap_resources_into_scope ( expr , d ) if pre_compute_ : d3 = dict ( ( ( e , pre_compute_ ( e , dat , ** kwargs ) ) for ( e , dat ) in d2 . items ( ) if ( e in expr2 ) ) ) else : d3 = d2 if optimize_ : try : expr3 = optimize_ ( expr2 , * [ v for ( e , v ) in d3 . items ( ) if ( e in expr2 ) ] ) _d = dict ( zip ( expr2 . _leaves ( ) , expr3 . _leaves ( ) ) ) d4 = dict ( ( ( e . _subs ( _d ) , d ) for ( e , d ) in d3 . items ( ) ) ) except NotImplementedError : expr3 = expr2 d4 = d3 else : expr3 = expr2 d4 = d3 result = top_then_bottom_then_top_again_etc ( expr3 , d4 , ** kwargs ) if post_compute_ : result = post_compute_ ( expr3 , result , scope = d4 ) if ( return_type is no_default ) : msg = "The default behavior of compute will change in version >= 0.11 where the `return_type` parameter will default to 'core'." warnings . warn ( msg , DeprecationWarning ) elif ( return_type == 'core' ) : result = coerce_core ( result , expr . dshape ) elif isinstance ( return_type , type ) : result = into ( return_type , result , dshape = expr3 . dshape ) elif ( return_type != 'native' ) : raise ValueError ( 'Invalid return_type passed to compute: {}' . format ( return_type ) ) return result
evaluate more than one delayed at once .