sparse_categorical_crossentropy as a string for back-compatibility with previous Keras versions

This commit is contained in:
Fabio Manganiello 2020-10-28 19:40:46 +01:00
parent 85f99e7362
commit a1c8e6bee1

View file

@ -18,7 +18,7 @@ class Model:
# noinspection PyShadowingNames # noinspection PyShadowingNames
def __init__(self, layers: Optional[List[Layer]] = None, labels: Optional[List[str]] = None, def __init__(self, layers: Optional[List[Layer]] = None, labels: Optional[List[str]] = None,
model: Optional[_Model] = None, optimizer: Union[str, optimizers.Optimizer] = 'adam', model: Optional[_Model] = None, optimizer: Union[str, optimizers.Optimizer] = 'adam',
loss: Union[str, losses.Loss] = losses.SparseCategoricalCrossentropy(from_logits=True), loss: Union[str, Union[str, losses.Loss]] = 'sparse_categorical_crossentropy',
metrics: List[Union[str, metrics.Metric]] = ('accuracy',), metrics: List[Union[str, metrics.Metric]] = ('accuracy',),
low_freq: int = AudioSegment.default_low_freq, low_freq: int = AudioSegment.default_low_freq,
high_freq: int = AudioSegment.default_high_freq): high_freq: int = AudioSegment.default_high_freq):