Skip to content

Instantly share code, notes, and snippets.

View makdoudN's full-sized avatar
🏠
Working from home

Makdoud makdoudN

🏠
Working from home
  • Palaiseau, France
View GitHub Profile
@makdoudN
makdoudN / print_latex_table.py
Created December 17, 2020 00:23 — forked from yanlend/print_latex_table.py
Python script to print Numpy arrays to LateX table
'''
Created on 26.02.2016
Print numpy arrays to latex tables
@author: Peter Fischer
'''
from __future__ import print_function, division
def print_to_table(avgs, stds, rows, cols,
@makdoudN
makdoudN / tree_reduce.py
Last active April 1, 2021 07:47 — forked from willwhitney/tree_stack.py
utility apply reduce function to a pytree (or a pytree of pytree)
import numpy as np
from jax import numpy as jnp
from jax.lib import pytree
def reduce(trees, op=jnp.stack, op_kwargs: dict = {}):
"""Takes a list of trees and apply op to every corresponding leaf.
For example, assuming op=`jnp.stack`,
given two trees ((a, b), c) and ((a', b'), c'), returns