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
#include <limits> | |
#include <array> | |
#include <cassert> | |
#include <iostream> | |
#include <string> | |
#include <vector> | |
#define MO 998244353 | |
template <typename T, size_t rank> |
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 socket | |
import time | |
import copy | |
import struct | |
import socketserver | |
import select | |
####################################################################### | |
# package pyaes # | |
####################################################################### |
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
from __future__ import print_function | |
import argparse | |
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
import torch.optim as optim | |
from torchvision import datasets, transforms | |
import torchvision | |
class Net(nn.Module): |
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
''' | |
This proof-of-concept follows [PRML](https://www.microsoft.com/en-us/research/people/cmbishop/prml-book/)'s idea. | |
This code extends plain HMM in the way that it has different transition matrix and emission matrix on different features `xs`. | |
To get a normal HMM, you can set all `x` to the same. | |
`HMM.predict()` uses formula (13.44) in PRML, which considers the whole seen sequence of observation `y`s. | |
If you have no observed `y`s and only have `x`s, you can use `model.trans(x).view(T, N, self.H, self.H).softmax(dim=3)` as transition matrix to get predicted sequence. | |
`gamma` here represents posterior probability of hidden states. | |
''' |
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 sys | |
import fire | |
class Beijing: | |
max_base = 28221 | |
min_base = 5360 | |
def __init__(self, total): | |
self.total = total | |
def wuxianyijin(self): |
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 gzip | |
import logging | |
import pickle | |
import time | |
import yaml | |
from tqdm import tqdm | |
def cached(cache_path): | |
def wrapper(func): |
OlderNewer