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
ezyang-mbp:labs ezyang$ cat a.kk | |
fun f(x: list<int>) : int { | |
match(x) { | |
Nil() -> 0 | |
Cons(_, _) -> 1 | |
} | |
} | |
fun reuse( g : list<int> -> int, x : list<int>) : (int, int) { | |
(f(x), g(x)) |
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
ezyang-mbp:labs ezyang$ cat a.kk | |
fun f(x: list<int>) : int { | |
length(x) | |
} | |
fun reuse( g : list<int> -> int, x : list<int>) : (int, int) { | |
(f(x), g(x)) | |
} | |
ezyang-mbp:labs ezyang$ koka -O2 -l -c --showcore a.kk | |
compile: a.kk |
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 dataclasses import dataclass | |
from typing import List, Tuple, Union, Dict, Iterator, Optional | |
import sys | |
import itertools | |
Id = int | |
class UnionFind: | |
parents: List[Id] |
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
% Solution to https://teammatehunt.com/puzzles/icebreaker | |
#script (python) | |
def main(ctl): | |
ctl.ground([("base", [])]) | |
seen = set() | |
with ctl.solve(yield_=True) as h: | |
for m in h: | |
terms = m.symbols(shown=True) | |
terms.sort() |
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
person(alice; bob; carol; david). | |
number(alice, 2). | |
number(bob, 3). | |
number(carol, 5). | |
number(david, 7). | |
distinct(A, B, C, D) | |
:- number(A, NA), number(B, NB), number(C, NC), number(D, ND), | |
NA * NB * NC * ND = 210. |
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
% solution for https://puzzlehunt.club.cc.cmu.edu/puzzle/15011/ | |
#script (python) | |
from clingo import Function | |
from collections import defaultdict | |
import operator | |
from colored import bg, attr | |
MAP = """ | |
..B#.~.... |
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
% solution for https://puzzlehunt.club.cc.cmu.edu/puzzle/15026/ | |
% define a 6x6 grid, and compass directions on this grid | |
row(1..6). | |
col(1..6). | |
dir(n;e;s;w). | |
delta(n, -1, 0). |
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 dataclasses import dataclass | |
from typing import Generator, TypeVar, Any, Callable, Optional, cast, NamedTuple, Dict, Type, Tuple, Generic | |
R = TypeVar("R") | |
Eff = Generator[Tuple[Any, ...], Any, R] | |
def handle_op( | |
g: Eff[R], | |
op: Tuple[Any, ...], |
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
# Translation of JIT type to a C++ argument type. | |
# TODO: remove use_c10_dispatcher_full kwarg from this function; type | |
# translation ideally doesn't depend on this | |
def argument_type(t: Type, *, mutable: bool, use_c10_dispatcher_full: bool) -> str: | |
# If it's a value type, do the value type translation | |
r = cpp_value_type(t) | |
if r is not None: | |
return r | |
if isinstance(t, BaseType): |
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
diff --git a/build/aten/src/ATen_new/Functions.cpp b/build/aten/src/ATen/Functions.cpp | |
index 240605711c..2d3aacf897 100644 | |
--- a/build/aten/src/ATen_new/Functions.cpp | |
+++ b/build/aten/src/ATen/Functions.cpp | |
@@ -188,7 +188,7 @@ Tensor _cudnn_init_dropout_state(double dropout, bool train, int64_t dropout_see | |
static auto op = c10::Dispatcher::singleton() | |
.findSchemaOrThrow("aten::_cudnn_init_dropout_state", "") | |
.typed<Tensor (double, bool, int64_t, c10::optional<ScalarType>, c10::optional<Layout>, c10::optional<Device>, c10::optional<bool>)>(); | |
- return op.call(dropout, train, dropout_seed, dtype, layout, device, pin_memory); | |
+ return op.call(dropout, train, dropout_seed, optTypeMetaToScalarType(options.dtype_opt()), options.layout_opt(), options.device_opt(), options.pinned_memory_opt()); |