MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / GetShardingFromNodeDef

Function GetShardingFromNodeDef

tensorflow/compiler/tf2xla/sharding_util.cc:29–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27
28namespace {
29xla::StatusOr<absl::optional<xla::OpSharding>> GetShardingFromNodeDef(
30 const NodeDef& node_def) {
31 if (!HasNodeAttr(node_def, kShardingAttribute)) {
32 return absl::optional<xla::OpSharding>();
33 }
34 string value;
35 xla::OpSharding sharding;
36 TF_RETURN_IF_ERROR(GetNodeAttr(node_def, kShardingAttribute, &value));
37 if (!sharding.ParseFromString(value)) {
38 return xla::InvalidArgument(
39 "Experimental _XlaSharding attribute was not a valid encoded "
40 "xla::OpSharding proto.");
41 }
42 return absl::optional<xla::OpSharding>(sharding);
43}
44
45Status CoreOutOfRangeError(int core, int num_cores_per_replica) {
46 return errors::InvalidArgument(

Callers 1

ParseShardingFromDeviceFunction · 0.85

Calls 3

InvalidArgumentFunction · 0.85
GetNodeAttrFunction · 0.50
ParseFromStringMethod · 0.45

Tested by

no test coverage detected