# Buggy code
def get_from_freq(cls, freq: str, add_trend: bool = DEFAULT_ADD_TREND):
    offset = to_offset(freq)

    seasonal_issms: List[SeasonalityISSM] = []

    if offset.name == "M":
        seasonal_issms = [
            SeasonalityISSM(num_seasons=12)  # month-of-year seasonality
        ]
    elif offset.name == "W-SUN":
        seasonal_issms = [
            SeasonalityISSM(num_seasons=53)  # week-of-year seasonality
        ]
    elif offset.name == "D":
        seasonal_issms = [SeasonalityISSM(num_seasons=7)]  # day-of-week seasonality
    elif offset.name == "B":  # TODO: check this case
        seasonal_issms = [SeasonalityISSM(num_seasons=7)]  # day-of-week seasonality
    elif offset.name == "H":
        seasonal_issms = [
            SeasonalityISSM(num_seasons=24),  # hour-of-day seasonality
            SeasonalityISSM(num_seasons=7),  # day-of-week seasonality
        ]
    elif offset.name == "T":
        seasonal_issms = [
            SeasonalityISSM(num_seasons=60),  # minute-of-hour seasonality
            SeasonalityISSM(num_seasons=24),  # hour-of-day seasonality
        ]
    else:
        RuntimeError(f"Unsupported frequency {offset.name}")

    return cls(seasonal_issms=seasonal_issms, add_trend=add_trend)


# Traceback (mxnet.base.MXNetError)
Traceback (most recent call last):
File "D:/python/DeepSSM/deep ISSM.py", line 53, in <module>
predictor = estimator.train(dataset.train)
File "D:\python\DeepSSM\gluonts\model\estimator.py", line 254, in train
training_data, validation_data, num_workers, num_prefetch, **kwargs
File "D:\python\DeepSSM\gluonts\model\estimator.py", line 233, in train_model
validation_iter=validation_data_loader,
File "D:\python\DeepSSM\gluonts\trainer\_base.py", line 308, in __call__
epoch_loss = loop(epoch_no, train_iter)
File "D:\python\DeepSSM\gluonts\trainer\_base.py", line 242, in loop
output = net(*inputs)
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\gluon\block.py", line 540, in __call__
out = self.forward(*args)
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\gluon\block.py", line 917, in forward
return self.hybrid_forward(ndarray, x, *args, **params)
File "D:\python\DeepSSM\gluonts\model\deepstate\_network.py", line 193, in hybrid_forward
length=self.past_length,
File "D:\python\DeepSSM\gluonts\model\deepstate\_network.py", line 151, in compute_lds
) = self.issm.get_issm_coeff(seasonal_indicators)
File "D:\python\DeepSSM\gluonts\model\deepstate\issm.py", line 132, in get_issm_coeff
self.innovation_coeff(seasonal_indicators),
File "D:\python\DeepSSM\gluonts\model\deepstate\issm.py", line 247, in innovation_coeff
axis=2
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\ndarray\ndarray.py", line 1695, in squeeze
return op.squeeze(self, *args, **kwargs)
File "<string>", line 45, in squeeze
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\_ctypes\ndarray.py", line 92, in _imperative_invoke
ctypes.byref(out_stypes)))
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\base.py", line 252, in check_call
raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: [13:47:56] c:\jenkins\workspace\mxnet-tag\mxnet\src\operator\tensor\./matrix_op-inl.h:2178: Check failed: dshape[axes[i]] == 1 (2 vs. 1) cannot select an axis to squeeze out which has size=2 not equal to one

# Fixed code
def get_from_freq(cls, freq: str, add_trend: bool = DEFAULT_ADD_TREND):
    offset = to_offset(freq)

    seasonal_issms: List[SeasonalityISSM] = []

    if offset.name == "M":
        seasonal_issms = [MonthOfYearSeasonalISSM()]
    elif offset.name == "W-SUN":
        seasonal_issms = [WeekOfYearSeasonalISSM()]
    elif offset.name == "D":
        seasonal_issms = [DayOfWeekSeasonalISSM()]
    elif offset.name == "B":  # TODO: check this case
        seasonal_issms = [DayOfWeekSeasonalISSM()]
    elif offset.name == "H":
        seasonal_issms = [
            HourOfDaySeasonalISSM(),
            DayOfWeekSeasonalISSM(),
        ]
    elif offset.name == "T":
        seasonal_issms = [
            MinuteOfHourSeasonalISSM(),
            HourOfDaySeasonalISSM(),
        ]
    else:
        RuntimeError(f"Unsupported frequency {offset.name}")

    return cls(seasonal_issms=seasonal_issms, add_trend=add_trend)