Skip to content

Instantly share code, notes, and snippets.

View mratsim's full-sized avatar
:shipit:

Mamy Ratsimbazafy mratsim

:shipit:
  • Paris
View GitHub Profile
@mratsim
mratsim / interpreter_bench.nim
Last active June 12, 2018 13:14
Computed Gotos bench
import random, sequtils, times
type
Op = enum
Halt # = 0x0000
Inc # = 0x0100
Dec # = 0x0110
Mul2 # = 0x0230
Div2 # = 0x0240
Add7 # = 0x0307
@mratsim
mratsim / enum_holes.nim
Created June 11, 2018 12:26
Fill enum with holes
# Nimbus
# Copyright (c) 2018 Status Research & Development GmbH
# Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
# at your option. This file may not be copied, modified, or distributed except according to those terms.
import macros, strformat, strutils
macro fill_enum_holes(x: untyped): untyped =
# Nimbus
# Copyright (c) 2018 Status Research & Development GmbH
# Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
# at your option. This file may not be copied, modified, or distributed except according to those terms.
import
stint, eth_common, tables, math,
../../opcode_values,
# Nimbus
# Copyright (c) 2018 Status Research & Development GmbH
# Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
# at your option. This file may not be copied, modified, or distributed except according to those terms.
import tables
type
@mratsim
mratsim / eip0_shared_values.ipynb
Last active July 9, 2018 18:32
State of the art NLP on Ethereum community survey on shared values
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Ref: Discussion started at https://irclogs.nim-lang.org/19-05-2018.html#12:45:21

transmogrifier

noun

someone or something that can change or transform its appearance to something else

Following heated debates in the Nim community whether Nim was a compiled to C or transpiled to C, and also compiled to JS or transpiled to JS, with arguments one way or another,

/* Copyright (c) 1993-2016, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
@mratsim
mratsim / gru_step2_backprop.nim
Last active May 12, 2018 10:50
Determining GRU backward pass
import ../src/arraymancer, sugar
func sigmoid*[T: SomeReal](x: T): T {.inline.} =
1 / (1 + exp(-x))
proc gru_cell_step2_update_gate_backward[T: SomeReal](
dz: Tensor[T], # Incoming gradient
z: Tensor[T], # Post sigmoid activation forward tensor
dWzx, dUzh: var Tensor[T]
) =
[Suite] vm json tests
vmTestsboolean.json
test_helpers.nim(48) test_vm_json
computation.nim(278) testFixture
computation.nim(272) :anonymous
context.nim(27) caller
stack.nim(67) push
validation.nim(48) validateStackItem
Unhandled exception: Invalid stack item: expected 32 bytes, got 42: value is 0xcd1722f3947def4cf144679da39c4c32bdc35681
@mratsim
mratsim / dl-frameworks.rst
Created May 11, 2018 12:14 — forked from bartvm/dl-frameworks.rst
A comparison of deep learning frameworks

A comparison of Theano with other deep learning frameworks, highlighting a series of low-level design choices in no particular order.

Overview

Symbolic: Theano, CGT; Automatic: Torch, MXNet

Symbolic and automatic differentiation are often confused or used interchangeably, although their implementations are significantly different.