Skip to content

Instantly share code, notes, and snippets.

View herberteuler's full-sized avatar

Guanpeng Xu herberteuler

  • Burnaby, BC, Canada
  • 12:00 (UTC -07:00)
View GitHub Profile
@herberteuler
herberteuler / libtorch_all_version.md
Created March 28, 2022 06:48 — forked from jnulzl/libtorch_all_version.md
Win && Linux libtorch 1.4.0 ~ 1.10.1 gpu&&cpu version url

Linux libtorch 1.4.0 ~ 1.10.1 gpu version url

  • cxx11 ABI
libtorch-cxx11-abi-shared-with-deps-1.4.0+cu92.zip : https://download.pytorch.org/libtorch/cu92/libtorch-cxx11-abi-shared-with-deps-1.4.0%2Bcu92.zip
libtorch-cxx11-abi-shared-with-deps-1.4.0+cu100.zip : https://download.pytorch.org/libtorch/cu100/libtorch-cxx11-abi-shared-with-deps-1.4.0%2Bcu100.zip
libtorch-cxx11-abi-shared-with-deps-1.4.0.zip : https://download.pytorch.org/libtorch/cu101/libtorch-cxx11-abi-shared-with-deps-1.4.0.zip
libtorch-cxx11-abi-shared-with-deps-1.5.0+cu92.zip : https://download.pytorch.org/libtorch/cu92/libtorch-cxx11-abi-shared-with-deps-1.5.0%2Bcu92.zip

At the beginning of 2030, I found this essay in my archives. From what I know today, I think it was very insightful at the moment of writing. And I feel it should be published because it can teach us, Rust developers, how to prevent that sad story from happening again.


What killed Haskell, could kill Rust, too

What killed Haskell, could kill Rust, too. Why would I even mention Haskell in this context? Well, Haskell and Rust are deeply related. Not because Rust is Haskell without HKTs. (Some of you know what that means, and the rest of you will wonder for a very long time). Much of the style of Rust is similar in many ways to the style of Haskell. In some sense Rust is a reincarnation of Haskell, with a little bit of C-ish like syntax, a very small amount.

Is Haskell dead?

// Estimating CPU frequency...
// CPU frequency: 4.52 GHz
// sum1: value = 15182118497126522709, 0.31 secs, 5.14 cycles/elem
// sum2: value = 15182118497126522709, 0.17 secs, 2.93 cycles/elem
#define RW(x) asm("" : "+r"(x))
typedef struct Node {
u64 value;
struct Node *next;
{ lib
, stdenv
, patchelf
, fetchurl
, coreutils
, python3
, writeTextFile
, makeWrapper
, requireFile
, alsa-lib
with import <nixpkgs> {};
(let
my-python =
let packageOverrides = self: super: {
dask = super.dask.overridePythonAttrs (old: rec {
version = "2.15.0";
src = super.fetchPypi {
inherit (old) pname;
import dask.array as da
import numpy as np
arr = da.from_array(np.arange(9).reshape(3,3))
a = da.min(arr)
b = da.max(arr)
quantiles = da.linspace(a, b, 4)
print(np.array(quantiles))
# Traceback (most recent call last):
import numpy as np
import tensorflow as tf
def input_fn():
def parse(tensor):
return tensor[:3], tensor[-1:]
ds = tf.data.Dataset.from_tensor_slices(np.random.random_sample([10,4]))
ds = ds.map(parse).batch(10).repeat(5)
return ds
import numpy as np
import tensorflow as tf
def input_fn():
def parse(tensor):
return tensor[:3], tensor[-1:]
ds = tf.data.Dataset.from_tensor_slices(np.random.random_sample([10,4]))
ds = ds.map(parse).batch(10).repeat(5)
return ds
case class Foo(s: String, n: Int)
class MyClient(url: URL) extends featherbed.Client(url) {
override def clientTransform(client: Http.Client) = {
client.withSessionPool.maxSize(1)
}
}
val client = new MyClient(new URL("http://localhost:8766/api/"))
val req = client.post("foo/bar")
@herberteuler
herberteuler / MyStateT.hs
Created March 25, 2015 10:19
Implementing MyStateT
data MyStateT s m a = MyStateT (s -> m (a, s))
runStateT :: MyStateT s m a -> s -> m (a, s)
runStateT = \ (MyStateT f) s -> f s
get :: Monad m => MyStateT s m s
get = MyStateT $ \ s -> return (s, s)
put :: Monad m => s -> MyStateT s m ()
put = \ s -> MyStateT $ \ s' -> return ((), s)