1
votes

I don't have any experience with abtract classes. But I need to use them for a script/

I imported the following:

from abc import ABCMeta, abstractmethod
from collections.abc import Callable, Mapping
from typing import Any, Optional, Tuple

When defining the variable loss_fn as follows:

LossFn = Callable[[tf.Tensor, tf.Tensor, Optional[tf.Tensor]],
                  Tuple[tf.Tensor, tf.Tensor, tf.Tensor, Optional[tf.Tensor]]]

I face the following error:

'ABCMeta' object is not subscriptable

Could someone help with debugging this issue please?

You want to import Callable from typing, not collections.abc…?! - deceze