A type spec for tfgnn.NodeSet
.
tfgnn.NodeSetSpec(
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_field_specs( *, features_spec: Optional[FieldsSpec] = None, sizes_spec: FieldSpec ) -> 'NodeSetSpec'
The counterpart of NodeSet.from_fields()
for values type specs.
@classmethod
from_value( value: GraphPieceBase )
Extension Types API: Factory method.
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 .
|
relax(
*, num_components: bool = False, num_nodes: bool = False
) -> 'NodeSetSpec'
Allows variable number of nodes or/and graph components.
Calling with all default parameters keeps the spec unchanged.
Args | |
---|---|
num_components
|
if True, allows variable number of graph components by
setting the outermost sizes dimension to None .
|
num_nodes
|
if True, allows variable number of nodes by setting the
outermost features dimensions to None .
|
Returns | |
---|---|
Relaxed compatible edge set spec. |
Raises | |
---|---|
ValueError
|
if edge set 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__(
feature_name: FieldName
) -> FieldSpec
__ne__(
other
) -> bool
Return self!=value.