integrating new CNN model

This commit is contained in:
Dobromir Popov
2025-07-23 16:59:35 +03:00
parent 1be270cc5c
commit f1d63f9da6
15 changed files with 1896 additions and 1003 deletions

View File

@ -371,6 +371,10 @@ class EnhancedCNN(nn.Module):
nn.Linear(128, 4) # Low risk, medium risk, high risk, extreme risk
)
def _memory_barrier(self, tensor: torch.Tensor) -> torch.Tensor:
"""Create a memory barrier to prevent in-place operation issues"""
return tensor.detach().clone().requires_grad_(tensor.requires_grad)
def _check_rebuild_network(self, features):
"""Check if network needs to be rebuilt for different feature dimensions"""
# Prevent rebuilding with zero or invalid dimensions