File size: 253 Bytes
1c7bc31
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
import yaml

def load_yaml(path):
    with open(path, "r", encoding="utf-8") as f:
        return yaml.safe_load(f)

def softmax(xs):
    import numpy as np
    x = np.array(xs, dtype=float)
    e = np.exp(x - x.max())
    return (e / e.sum()).tolist()