File size: 699 Bytes
60b21d3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # SPDX-FileCopyrightText: 2025 Stanford University, ETH Zurich, and the project authors (see CONTRIBUTORS.md)
# SPDX-FileCopyrightText: 2025 This source file is part of the OpenTSLM open-source project.
#
# SPDX-License-Identifier: MIT
from abc import abstractmethod
import torch
import torch.nn as nn
from opentslm.model_config import ENCODER_OUTPUT_DIM
class TimeSeriesEncoderBase(nn.Module):
def __init__(
self,
output_dim: int = ENCODER_OUTPUT_DIM,
dropout: float = 0.0,
):
super().__init__()
self.output_dim = output_dim
self.dropout = dropout
@abstractmethod
def forward(self, x: torch.Tensor) -> torch.Tensor:
pass
|