MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / _forward

Method _forward

bench/embedding_experiment.py:85–91  ·  view source on GitHub ↗
(self, X: np.ndarray)

Source from the content-addressed store, hash-verified

83 self.lr = lr
84
85 def _forward(self, X: np.ndarray):
86 h = X @ self.W1 + self.b1
87 h_relu = np.maximum(0, h)
88 logits = h_relu @ self.W2 + self.b2
89 exp_l = np.exp(logits - logits.max(axis=1, keepdims=True))
90 probs = exp_l / exp_l.sum(axis=1, keepdims=True)
91 return h, h_relu, logits, probs
92
93 def train(self, X: np.ndarray, y: np.ndarray, epochs: int = 60, batch_size: int = 64):
94 rng = np.random.RandomState(42)

Callers 2

trainMethod · 0.95
predictMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected