(host_calls)
return ret
Runs on the host_call on CPU instead of TPU when use_tpu=False.
Runs on the host_call on CPU instead of TPU when use_tpu=False.
Runs on the host_call on CPU instead of TPU when use_tpu = False .
def create_cpu_hostcall(host_calls):
    """Runs on the host_call on CPU instead of TPU when use_tpu=False."""

    _OutfeedHostCall.validate(host_calls)
    ret = {}
    for name, host_call in host_calls.items():
      host_fn, tensors = host_call
      if isinstance(tensors, (tuple, list)):
        ret[name] = host_fn(*tensors)
      else:
        # Must be dict.
        try:
          ret[name] = host_fn(**tensors)
        except TypeError as e:
          logging.warning(
              'Exception while calling %s: %s. It is likely the tensors '
              '(%s[1]) do not match the '
              'function\'s arguments', name, e, name)
          raise e
    return ret
def create_cpu_hostcall ( host_calls ) : _OutfeedHostCall . validate ( host_calls ) ret = { } for name , host_call in host_calls . items ( ) : host_fn , tensors = host_call if isinstance ( tensors , ( tuple , list ) ) : ret [ name ] = host_fn ( * tensors ) else : # Must be dict. try : ret [ name ] = host_fn ( * * tensors ) except TypeError as e : logging . warning ( 'Exception while calling %s: %s. It is likely the tensors ' '(%s[1]) do not match the ' 'function\'s arguments' , name , e , name ) raise e return ret