Skip to content

Commit

Permalink
Add missing doc strings for 4 methods under layout.py.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 442615805
  • Loading branch information
tensorflower-gardener authored and tensorflow-jenkins committed Apr 19, 2022
1 parent 616da55 commit c6cc7f6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tensorflow/dtensor/python/layout.py
Expand Up @@ -190,6 +190,7 @@ def name(self) -> str:
return self._name

def is_remote(self) -> bool:
"""Returns True if a Mesh contains only remote devices."""
return not self._local_device_ids and self._global_device_ids.size > 0

def host_mesh(self):
Expand Down Expand Up @@ -220,9 +221,11 @@ def host_mesh(self):
return h_mesh

def device_type(self) -> str:
"""Returns the device_type of a Mesh."""
return self._device_type

def contains_dim(self, dim_name: str) -> bool:
"""Returns True if a Mesh contains the given dimension name."""
return dim_name in self._dim_dict

def __contains__(self, dim_name: str) -> bool:
Expand Down Expand Up @@ -404,6 +407,7 @@ def from_proto(proto: layout_pb2.MeshProto) -> 'Mesh':
global_devices)

def shape(self) -> List[int]:
"""Returns the shape of the mesh."""
return [self.dim_size(dim) for dim in self._dim_names]

@property
Expand Down

0 comments on commit c6cc7f6

Please sign in to comment.