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
#!/usr/bin/env python | |
import argparse | |
import chainer | |
import chainer.functions as F | |
import chainer.links as L | |
from chainer import training | |
from chainer.training import extensions | |
import chainerx |
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
# Attempt to mimick following GADT (Generalized algebraic data type) in Python: | |
# | |
# data Expr a where | |
# Const :: a -> Expr a | |
# Add :: Expr Int -> Expr Int -> Expr Int | |
# Eq :: Expr Int -> Expr Int -> Expr Bool | |
# IfThenElse :: Expr Bool -> Expr a -> Expr a -> Expr a | |
import abc | |
from typing import Generic, TypeVar |
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
# Encoding existential types in Python using ∃X. F(X) ≅ ∀R. (∀X. F(X) → R) → R. | |
import abc | |
from typing import Generic, TypeVar | |
S = TypeVar('S') | |
R = TypeVar('R') | |
class Automata(Generic[S], metaclass=abc.ABCMeta): |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
license: gpl-3.0 | |
height: 600 |
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
print(0x10000000000000000 is 0x10000000000000000) | |
#=> True | |
import dis | |
b = dis.Bytecode(lambda: 0x10000000000000000 is 0x10000000000000000) | |
print(b.dis()) | |
#=> | |
# 4 0 LOAD_CONST 1 (18446744073709551616) | |
# 2 LOAD_CONST 1 (18446744073709551616) | |
# 4 COMPARE_OP 8 (is) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
year | month | day | wday | |
---|---|---|---|---|
2158 | 4 | 19 | 3 | |
2020 | 8 | 11 | 2 | |
2010 | 5 | 15 | 6 | |
2088 | 11 | 30 | 2 | |
2181 | 5 | 28 | 1 | |
2162 | 5 | 16 | 0 | |
2175 | 11 | 17 | 5 | |
2018 | 4 | 5 | 4 | |
2287 | 1 | 24 | 1 |
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
#!/usr/bin/env python | |
# Contact: Will Wade willwa.de | |
# Date: April 2013 | |
# Needs mechanize and pybtex | |
# | |
# NB: Little error checking going on in this script | |
# TO-DO: Check last-download-date of bibtex file later than last-modified date on CUL. ? possible | |
# | |
# With thanks to https://pypi.python.org/pypi/citeulike_api/0.1.3dev for the login part | |
import mechanize |
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 abc import ABCMeta, abstractmethod | |
import numpy as np | |
import scipy.linalg | |
import pivots | |
def beye(nBatch, n, dtype): | |
return np.broadcast_to(np.expand_dims(np.eye(n, dtype=dtype), 0), (nBatch, n, n)) | |