This file contains hidden or 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 | |
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 |
This file contains hidden or 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
''' | |
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, |