A type spec for tfgnn.HyperAdjacency
.
tfgnn.HyperAdjacencySpec(
data_spec: DataSpec,
shape: tf.TensorShape,
indices_dtype: tf.dtypes.DType,
row_splits_dtype: tf.dtypes.DType,
metadata: Metadata = None,
check_consistent_indices_dtype: bool = False,
check_consistent_row_splits_dtype: bool = False
)
experimental_as_proto() -> struct_pb2.TypeSpecProto
Returns a proto representation of the TypeSpec instance.
Do NOT override for custom non-TF types.
@classmethod
experimental_from_proto( proto: struct_pb2.TypeSpecProto ) -> 'TypeSpec'
Returns a TypeSpec instance based on the serialized proto.
Do NOT override for custom non-TF types.
Args | |
---|---|
proto
|
Proto generated using 'experimental_as_proto'. |
@classmethod
experimental_type_proto() -> Type[struct_pb2.TypeSpecProto]
Returns the type of proto associated with TypeSpec serialization.
Do NOT override for custom non-TF types.
@classmethod
from_incident_node_sets( incident_node_sets: Mapping[IncidentNodeTag, NodeSetName], index_spec:
tfgnn.FieldSpec
= tf.TensorSpec((None,), const.default_indices_dtype) ) -> 'HyperAdjacencySpec'
Constructs a new instance from the incident_node_sets
.
Args | |
---|---|
incident_node_sets
|
A mapping from incident node tags to node set names. |
index_spec
|
type spec for all index tensors of shape
[*graph_shape, num_edges] , where num_edges is the number of edges in
each graph. If num_edges is not None or graph_shape.rank = 0 the
spec must be of tf.TensorSpec type and of tf.RaggedTensorSpec type
otherwise.
|
Returns | |
---|---|
A HyperAdjacencySpec TypeSpec.
|
@classmethod
from_value( value: GraphPieceBase )
Extension Types API: Factory method.
get_index_specs_dict() -> Dict[IncidentNodeTag, Tuple[NodeSetName, FieldSpec]]
Returns copy of indices type specs as a dictionary.
is_compatible_with(
spec_or_value
)
Returns true if spec_or_value
is compatible with this TypeSpec.
Prefer using "is_subtype_of" and "most_specific_common_supertype" wherever possible.
Args | |
---|---|
spec_or_value
|
A TypeSpec or TypeSpec associated value to compare against. |
is_subtype_of(
other: trace.TraceType
) -> bool
Returns True if self
is a subtype of other
.
Implements the tf.types.experimental.func.TraceType interface.
If not overridden by a subclass, the default behavior is to assume the TypeSpec is covariant upon attributes that implement TraceType and invariant upon rest of the attributes as well as the structure and type of the TypeSpec.
Args | |
---|---|
other
|
A TraceType object. |
most_specific_common_supertype(
others: Sequence[trace.TraceType]
) -> Optional['TypeSpec']
Returns the most specific supertype TypeSpec of self
and others
.
Implements the tf.types.experimental.func.TraceType interface.
If not overridden by a subclass, the default behavior is to assume the TypeSpec is covariant upon attributes that implement TraceType and invariant upon rest of the attributes as well as the structure and type of the TypeSpec.
Args | |
---|---|
others
|
A sequence of TraceTypes. |
most_specific_compatible_type(
other: 'TypeSpec'
) -> 'TypeSpec'
Returns the most specific TypeSpec compatible with self
and other
. (deprecated)
Deprecated: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use most_specific_common_supertype instead.
Deprecated. Please use most_specific_common_supertype
instead.
Do not override this function.
Args | |
---|---|
other
|
A TypeSpec .
|
Raises | |
---|---|
ValueError
|
If there is no TypeSpec that is compatible with both self
and other .
|
node_set_name(
node_set_tag: IncidentNodeTag
) -> NodeSetName
Returns a node set name for the given node set tag.
relax(
*, num_edges: bool = False
) -> 'HyperAdjacencySpec'
Allows variable number of graph edges.
Calling with all default parameters keeps the spec unchanged.
Args | |
---|---|
num_edges
|
if True, allows a variable number of edges in each edge set. If False, returns spec unchanged. |
Returns | |
---|---|
Relaxed compatible spec. |
Raises | |
---|---|
ValueError
|
if adjacency is not scalar (rank > 0). |
with_indices_dtype(
dtype: tf.dtypes.DType
) -> 'GraphPieceSpecBase'
Returns a copy of this piece spec with the given indices dtype.
with_row_splits_dtype(
dtype: tf.dtypes.DType
) -> 'GraphPieceSpecBase'
Returns a copy of this piece spec with the given row splits dtype.
with_shape(
new_shape: ShapeLike
) -> 'GraphPieceSpecBase'
Enforce the common prefix shape on all the contained features.
__eq__(
other
) -> bool
Return self==value.
__getitem__(
node_set_tag: IncidentNodeTag
) -> tfgnn.FieldSpec
Returns an index tensor type spec for the given node set tag.
__ne__(
other
) -> bool
Return self!=value.