tensorflow/compiler/mlir/tensorflow/transforms/tpu_sharding_identification_pass.cc
// Returns XLA sharding from argument connected via tf.aliasing_output.
Returns XLA sharding from argument connected via tf.aliasing_output.
Returns XLA sharding from argument connected via tf . aliasing_output .
llvm::Optional<StringRef> GetXlaShardingFromAlias(
    Value value, llvm::SmallVectorImpl<int>& aliases,
    const llvm::SmallVectorImpl<llvm::StringRef>& sharding_for_args) {
  int retval_index = value.cast<OpResult>().getResultNumber();
  if (retval_index >= 0 && retval_index < aliases.size()) {
    int arg_index = aliases[retval_index];
    if (arg_index >= 0 && arg_index < sharding_for_args.size()) {
      return sharding_for_args[arg_index];
    }
  }
  return llvm::None;
}
llvm :: Optional < StringRef > GetXlaShardingFromAlias ( Value value , llvm :: SmallVectorImpl < int > & aliases , const llvm :: SmallVectorImpl < llvm :: StringRef > & sharding_for_args ) { int retval_index = value . cast < OpResult > ( ) . getResultNumber ( ) ; if ( retval_index >= 0 && retval_index < aliases . size ( ) ) { int arg_index = aliases [ retval_index ] ; if ( arg_index >= 0 && arg_index < sharding_for_args . size ( ) ) { return sharding_for_args [ arg_index ] ; } } return llvm :: None ; }
Returns XLA sharding from argument connected via tf.aliasing_output.
Returns XLA sharding from argument connected via tf . aliasing_output .