@@ -470,10 +470,15 @@ def is_equal(self, other, ignore_feature_dim=False, allow_same_feature_dim=False
470
470
undefined_matches = False , derived_matches = False ):
471
471
"""
472
472
Compares self to other for equality.
473
+
473
474
Note that the default behavior is very restrictive.
474
475
Use functions such as :func:`get_all_dimension_tags` or :func:`get_existing_tag_from_collection`
475
476
to explicitly specify the behavior for the comparison.
476
477
478
+ Also note that the definition is slightly ad-hoc for some cases,
479
+ and might potentially change in the future.
480
+ https://github.com/rwth-i6/returnn/issues/634
481
+
477
482
:param DimensionTag other:
478
483
:param bool ignore_feature_dim:
479
484
:param bool allow_same_feature_dim:
@@ -540,6 +545,7 @@ def __eq__(self, other):
540
545
"""
541
546
:param DimensionTag other:
542
547
:rtype: bool
548
+ :return: :func:`is_equal` with default options
543
549
"""
544
550
if not isinstance (other , DimensionTag ):
545
551
return False
@@ -553,6 +559,10 @@ def __ne__(self, other):
553
559
return not (self == other )
554
560
555
561
def __hash__ (self ):
562
+ """
563
+ :rtype: int
564
+ :return: hash, matching to :func:`__eq__`
565
+ """
556
566
# This must match the behavior in __eq__, which is is_equal with default options.
557
567
# I.e. different hash implies not equal (but same hash not necessarily equal).
558
568
if self .is_batch_dim ():
0 commit comments