From 74c0ab73a6d037f07a9bfb4bfc329496434b9503 Mon Sep 17 00:00:00 2001 From: Albert Zeyer Date: Fri, 11 Aug 2023 17:31:21 +0200 Subject: [PATCH] fix new-style Dim import, TF independent --- datasets_old_2022_10/asr/librispeech/oggzip.py | 10 +++++----- datasets_old_2022_10/asr/timit/nltk.py | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/datasets_old_2022_10/asr/librispeech/oggzip.py b/datasets_old_2022_10/asr/librispeech/oggzip.py index 6221d8f4..f240a728 100644 --- a/datasets_old_2022_10/asr/librispeech/oggzip.py +++ b/datasets_old_2022_10/asr/librispeech/oggzip.py @@ -52,12 +52,12 @@ def get_extern_data(self) -> Dict[str, Dict[str, Any]]: """ Get extern data """ - from returnn.tf.util.data import FeatureDim, SpatialDim, batch_dim + from returnn.tensor import Dim, batch_dim - time_dim = SpatialDim("time") - feature_dim = FeatureDim("audio", self.audio_dim) - out_spatial_dim = SpatialDim("out-spatial") - classes_dim = FeatureDim("vocab", dimension=self.vocab.get_num_classes()) + time_dim = Dim(None, name="time", kind=Dim.Types.Spatial) + feature_dim = Dim(self.audio_dim, name="audio", kind=Dim.Types.Feature) + out_spatial_dim = Dim(None, name="out-spatial", kind=Dim.Types.Spatial) + classes_dim = Dim(self.vocab.get_num_classes(), name="vocab", kind=Dim.Types.Feature) return { "data": {"dim_tags": [batch_dim, time_dim, feature_dim]}, "classes": { diff --git a/datasets_old_2022_10/asr/timit/nltk.py b/datasets_old_2022_10/asr/timit/nltk.py index 2d2bbb49..55df2c18 100644 --- a/datasets_old_2022_10/asr/timit/nltk.py +++ b/datasets_old_2022_10/asr/timit/nltk.py @@ -37,11 +37,11 @@ def get_extern_data(self) -> Dict[str, Dict[str, Any]]: """ Get extern data """ - from returnn.tf.util.data import FeatureDim, SpatialDim, batch_dim + from returnn.tensor import Dim, batch_dim - feature_dim = FeatureDim("audio", self.audio_dim) - classes_dim = FeatureDim("phonemes", 61) - time_dim = SpatialDim("time") + feature_dim = Dim(self.audio_dim, name="audio", kind=Dim.Types.Feature) + classes_dim = Dim(61, name="phonemes", kind=Dim.Types.Feature) + time_dim = Dim(None, name="time", kind=Dim.Types.Spatial) return { "data": {"dim_tags": [batch_dim, time_dim, feature_dim]}, "classes": {"dim_tags": [batch_dim, time_dim], "sparse_dim": classes_dim},