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
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
class SoftMultiTokenEmbedding(nn.Module): | |
""" | |
A MultiToken embedding layer that performs soft merging of adjacent tokens | |
without requiring attention mask modifications. | |
""" | |
def __init__(self, vocab_size, embedding_dim, dropout_rate=0.1): |
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
/** | |
* Copyright (C) 2022 orIgo <[email protected]> | |
* | |
* Cycle exact 6502 (2A03) emulator. | |
* | |
* - To initialize the cpu, provide an initialized `cpu_bus_t *` with memory read/write primitives to `cpu_init()` . | |
* - For each tick/cycle, call `cpu_tick()` with the returned `cpu_t *`, checking the return value to detect HLT. | |
* - To cause an NMI request, call `cpu_nmi()`. | |
*/ | |
#include "cpu.h" |
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
import java.util.LinkedList; | |
import java.nio.charset.Charset; | |
import java.io.IOException; | |
import java.io.OutputStream; | |
import java.io.FileOutputStream; | |
public class Log4Simple | |
{ | |
public enum Level { |
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
%% Double Cola problem in Erlang | |
%% https://codeforces.com/problemset/problem/82/A | |
-module(main). | |
-export([start/1]). | |
start(N) -> | |
io:fwrite( | |
cola(N-1, [ {"Sheldon", 1}, | |
{"Leonard", 1}, |