def append(self, cls, infer_hidden: bool = False, **kwargs) -> Encoder:
        """
        Extends sequence with new Encoder. 'dtype' gets passed into Encoder instance if not present in parameters
        and supported by specific Encoder type.

        :param cls: Encoder type.
        :param infer_hidden: If number of hidden should be inferred from previous encoder.
        :param kwargs: Named arbitrary parameters for Encoder.

        :return: Instance of Encoder.
        """
        params = dict(kwargs)
        if infer_hidden:
            params['num_hidden'] = self.get_num_hidden()

        sig_params = inspect.signature(cls.__init__).parameters
        if 'dtype' in sig_params and 'dtype' not in kwargs:
            params['dtype'] = self.dtype
        encoder = cls(**params)
        self.encoders.append(encoder)
        return encoder
Extends sequence with new Encoder. 'dtype' gets passed into Encoder instance if not present in parameters
        and supported by specific Encoder type.

        :param cls: Encoder type.
        :param infer_hidden: If number of hidden should be inferred from previous encoder.
        :param kwargs: Named arbitrary parameters for Encoder.

        :return: Instance of Encoder.