tensorflow/core/common_runtime/graph_execution_state.cc
// Tensors of some DataTypes cannot placed in device memory as feeds or
// fetches. Validate against a allowlist of those known to work.
Tensors of some DataTypes cannot placed in device memory as feeds or
fetches. Validate against a allowlist of those known to work.
Tensors of some DataTypes cannot placed in device memory as feeds or fetches . Validate against a allowlist of those known to work .
bool IsFeedAndFetchSupported(DataType dtype, const string& device_type) {
   The mechanism for supporting fetches of device-backed Tensors requires
   the _Retval kernel to be registered for the corresponding type (and
   that the output is produced in device and not host memory).
   For now, we return true iff there are _Arg AND _Retval kernels for dtype on
   the device. False negatives are okay, false positives would be bad.
   TODO(ashankar): Instead of a allowlist here, perhaps we could query
   the kernel registry for _Arg and _Retval kernels instead.
  if (device_type == DEVICE_CPU) return true;
  if (device_type != DEVICE_GPU &&
      !DeviceFactory::IsPluggableDevice(device_type))
    return false;
  switch (dtype) {
    case DT_BFLOAT16:
    case DT_BOOL:
    case DT_COMPLEX128:
    case DT_COMPLEX64:
    case DT_DOUBLE:
    case DT_FLOAT:
    case DT_HALF:
    case DT_INT16:
    case DT_INT64:
    case DT_INT8:
    case DT_UINT16:
    case DT_UINT8:
      return true;
    default:
      return false;
  }
}
bool IsFeedAndFetchSupported ( DataType dtype , const string & device_type ) { if ( device_type == DEVICE_CPU ) return true ; if ( device_type != DEVICE_GPU && ! DeviceFactory :: IsPluggableDevice ( device_type ) ) return false ; switch ( dtype ) { case DT_BFLOAT16 : case DT_BOOL : case DT_COMPLEX128 : case DT_COMPLEX64 : case DT_DOUBLE : case DT_FLOAT : case DT_HALF : case DT_INT16 : case DT_INT64 : case DT_INT8 : case DT_UINT16 : case DT_UINT8 : return true ; default : return false ; } }
Tensors of some DataTypes cannot placed in device memory as feeds or
fetches.
Tensors of some DataTypes cannot placed in device memory as feeds or fetches .
// The mechanism for supporting feeds of device-backed Tensors requires // the _Arg kernel to be registered for the corresponding type (and that // the input to the kernel be in device and not host memory). // // The mechanism for supporting fetches of device-backed Tensors requires // the _Retval kernel to be registered for the corresponding type (and // that the output is produced in device and not host memory). // // For now, we return true iff there are _Arg AND _Retval kernels for dtype on // the device. False negatives are okay, false positives would be bad. // // TODO(ashankar): Instead of a allowlist here, perhaps we could query // the kernel registry for _Arg and _Retval kernels instead.