Added support for RNN

This commit is contained in:
HowToSD
2025-03-24 23:21:35 -07:00
parent b700c27160
commit 37d0f9da62
29 changed files with 2078 additions and 2 deletions
+16
View File
@@ -1,6 +1,8 @@
import os
import ast
from typing import Optional, Tuple, Union
import random
import numpy as np
import torch
@@ -137,3 +139,17 @@ def str_to_dim(dim: str) -> Optional[Union[int, Tuple[int, ...]]]:
return None
def set_seed(seed=42) -> None:
"""
Sets seed for random number generation.
Args:
seed (int): Initial seed.
"""
torch.manual_seed(seed)
np.random.seed(seed)
random.seed(seed)
if torch.cuda.is_available():
torch.cuda.manual_seed_all(seed)
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False