25 lines
813 B
Python
25 lines
813 B
Python
import torch
|
||
import torch.nn as nn
|
||
import torch.nn.functional as F
|
||
|
||
|
||
def conv_block(in_ch, out_ch):
|
||
"""2× (konvoluce 3×3 -> BatchNorm -> ReLU). Výška a šířka se nemění."""
|
||
# ===== TODO 2a =====
|
||
raise NotImplementedError("TODO 2a")
|
||
|
||
|
||
class MyModel(nn.Module):
|
||
def __init__(self, input_size=None, hidden_size=None, output_size=30, embedding_dim=128):
|
||
# input_size a hidden_size se nepoužívají, ale opravující je při vytváření modelu předává
|
||
super().__init__()
|
||
# ===== TODO 2b: vrstvy =====
|
||
|
||
def forward(self, x):
|
||
"""x [B, 3, 64, 64] -> (species [B, 30], masks [B, 1, 64, 64], embeddings [B, 128])"""
|
||
# ===== TODO 2c =====
|
||
raise NotImplementedError("TODO 2c")
|
||
|
||
def get_embedding(self, x):
|
||
return self.forward(x)[2]
|