tensorflow/core/grappler/optimizers/pin_to_host_optimizer.cc
// Check if Tensor is either a string or is integer and small size
Check if Tensor is either a string or is integer and small size
Check if Tensor is either a string or is integer and small size
bool IsTensorSmall(const OpInfo::TensorProperties& prop) {
  if (prop.dtype() == DataType::DT_STRING) {
    return true;
  }
  if (prop.dtype() != DataType::DT_INT32 &&
      prop.dtype() != DataType::DT_INT64 &&
      prop.dtype() != DataType::DT_FLOAT) {
    return false;
  }
  const int64_t size = NumCoefficients(prop.shape());
  if (size < 0 || size > kTensorMaxSize) {
    return false;
  }
  return true;
}
bool IsTensorSmall ( const OpInfo :: TensorProperties & prop ) { if ( prop . dtype ( ) == DataType :: DT_STRING ) { return true ; } if ( prop . dtype ( ) != DataType :: DT_INT32 && prop . dtype ( ) != DataType :: DT_INT64 && prop . dtype ( ) != DataType :: DT_FLOAT ) { return false ; } const int64_t size = NumCoefficients ( prop . shape ( ) ) ; if ( size < 0 || size > kTensorMaxSize ) { return false ; } return true ; }
Check if Tensor is either a string or is integer and small size
Check if Tensor is either a string or is integer and small size
// Check type to be int32 or int64. // Check size known and small.