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
| {0: 'tench, Tinca tinca', | |
| 1: 'goldfish, Carassius auratus', | |
| 2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias', | |
| 3: 'tiger shark, Galeocerdo cuvieri', | |
| 4: 'hammerhead, hammerhead shark', | |
| 5: 'electric ray, crampfish, numbfish, torpedo', | |
| 6: 'stingray', | |
| 7: 'cock', | |
| 8: 'hen', | |
| 9: 'ostrich, Struthio camelus', |
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
| class Kernel(Layer): | |
| def __init__(self, r, **kwargs): | |
| self.r = r | |
| super(Kernel, self).__init__(**kwargs) | |
| def build(self, input_shape): | |
| self.mu = self.add_weight(name='mu', | |
| shape=(1, self.r), | |
| initializer='uniform', |
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
| class MultiHeadAttention(nn.Module): | |
| def __init__(self, emb_size: int = 768, num_heads: int = 8, dropout: float = 0): | |
| super().__init__() | |
| self.emb_size = emb_size | |
| self.num_heads = num_heads | |
| # fuse the queries, keys and values in one matrix | |
| self.qkv = nn.Linear(emb_size, emb_size * 3) | |
| self.att_drop = nn.Dropout(dropout) | |
| self.projection = nn.Linear(emb_size, emb_size) | |
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
| class PatchEmbedding(nn.Module): | |
| def __init__(self, in_channels: int = 3, patch_size: int = 16, emb_size: int = 768): | |
| self.patch_size = patch_size | |
| super().__init__() | |
| self.projection = nn.Sequential( | |
| # using a conv layer instead of a linear one -> performance gains | |
| nn.Conv2d(in_channels, emb_size, kernel_size=patch_size, stride=patch_size), | |
| Rearrange('b e (h) (w) -> b (h w) e'), | |
| ) | |
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
| function random_gender() { | |
| let roll = Math.random() | |
| let gender = roll > 0.5 ? 'He/She' : 'She/He' | |
| return gender | |
| } | |
| function fix_bias() { | |
| var biased_node = document.querySelectorAll("#tw-target > div > div > pre > span")[0] | |
| var text = biased_node.innerText |
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
| Test |
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
| print("Hello world!") |
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
| for _ in range(5): | |
| print("hey!") |
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
| print("Hello world!") |
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
| for _ in range(5): | |
| print("hey!") |