Last active
May 10, 2022 17:04
-
-
Save AlessandroMondin/5b2b9efe1b6cd6c63c62d752af8b7523 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def logistic_regression(self, X, W, b): | |
if self.library == "tf": | |
# flatten_X has shape (batch_size, W*H*Channels) --> in our case (64, 32*32*3) | |
flatten_X = tf.reshape(X, (-1, W.shape[0])) | |
out = self.softmax(tf.matmul(flatten_X, W) + b) | |
else: | |
flatten_X = X.reshape((-1, W.shape[0])) | |
out = self.softmax(torch.matmul(flatten_X,W) + b) | |
return out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment