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 numpy as np | |
# ... | |
def relu(activations): | |
'''Sample 'ReLU' activation function for illustration purposes''' | |
return np.maximum(activations, 0) | |
def forward(model, batch, input_size, hidden_size, activation=relu, iterations=2): | |
'''Push a batch of input vectors (in rows) through an adjacency matrix (the 'model'). |
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
# Simple no-branching version of a list median | |
# Expects the list to contain at least one element, and be sorted already | |
fn(l) -> (Enum.at(l, floor((length(l)-1)/2)) + Enum.at(l, ceil((length(l)-1)/2)))/2 end | |
# or | |
fn(l) -> (length(l)-1)/2 |> &(&(Enum.at(l, floor(&1)) + Enum.at(l, ceil(&1)))/2).() end | |
# or | |
def median(list) do | |
(length(list)-1)/2 |
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
! Fork from: http://paste.factorcode.org/paste?id=808 | |
! Copyright (C) 2009 Tim Wawrzynczak | |
! See http://factorcode.org/license.txt for BSD license. | |
USING: kernel namespaces sequences accessors | |
joy.ast joy.parser joy.pprint vectors | |
combinators math assocs math.ranges random | |
quotations prettyprint math.functions | |
calendar math.order macros generalizations fry | |
parser words stack-checker ; |
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
echo 'yourfile(s).tex' | entr -s 'tectonic ueb9_1.tex && pkill -HUP mupdf' |
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
def find_many(list, funs), do: do_find_many(list, funs |> Enum.map(&({&1, nil}))) | |
defp do_find_many([h | t], funs, acc) do | |
new_funs = funs |> Enum.map( | |
fn {fun, nil} -> if fun.(h), do: {fun, h}, else: {fun, nil} | |
other -> other | |
end) | |
if Enum.any?(new_funs, fn {_, x} -> is_nil(x) end), do: t, else: [] | |
|> do_find_many(new_funs) | |
end |
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
Unchecked dependencies for environment test: | |
* vmq_commons (Hex package) | |
could not find an app file at _build/test/lib/vmq_commons/ebin/vmq_commons.app. This may happen if the dependency was not yet compiled, or you specified the wrong application name in your deps, or the dependency indeed has no app file (then you can pass app: false as option) | |
** (Mix) Can't continue due to errors on dependencies |
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 scala.pickling._ | |
import json._ | |
package testclasses { | |
sealed trait A | |
case class A1(b: B) extends A | |
case class A2(b: B) extends A | |
case class A3(b: B) extends A | |
case class A4(ab: Array[B]) extends A |