Skip to content

Commit

Permalink
fix new-style Dim import, TF independent
Browse files Browse the repository at this point in the history
  • Loading branch information
albertz committed Aug 11, 2023
1 parent 48f9e5b commit 74c0ab7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions datasets_old_2022_10/asr/librispeech/oggzip.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
8 changes: 4 additions & 4 deletions datasets_old_2022_10/asr/timit/nltk.py
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down

0 comments on commit 74c0ab7

Please sign in to comment.