Can methods of dataclasses be decorated with @tf.function? A straight-forward test
@dataclass
class Doubler:
@tf.function
def double(a):
return a*2
gives an error
d = Doubler()
d.double(2)
saying that Doubler is not hashable (TypeError: unhashable type: 'Doubler'), which I believe is because hashing is disabled by default for dataclasses. Is this a general limitation or can it be made to work? I found this answer that seems to indicate that it doesn't work.