This file contains 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
import os | |
from base64 import b64decode | |
# Handles a call from the intervals.icu OauthAPI, requests the auth token and returns this in a redirect URL | |
def lambda_handler(event, context): | |
# Generic error object to handle errors | |
def createErrorObject(reason): | |
return { | |
'statusCode': 301, |
This file contains 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
# Create custom classifier | |
class PoolingLinearClassifierSoftmax(nn.Module): | |
def __init__(self, layers, drops): | |
super().__init__() | |
self.layers = nn.ModuleList([ | |
LinearBlock(layers[i], layers[i + 1], drops[i]) for i in range(len(layers) - 1)]) | |
def pool(self, x, bs, is_max): | |
f = F.adaptive_max_pool1d if is_max else F.adaptive_avg_pool1d | |
return f(x.permute(1,2,0), (1,)).view(bs,-1) |