<s> import numpy as np <EOL> def categorical ( p , rng ) : <EOL> """<STR_LIT>""" <EOL> return np . argmax ( rng . multinomial ( <NUM_LIT:1> , p ) ) <EOL> def softmax ( z ) : <EOL> """<STR_LIT>""" <EOL> ex = np . exp ( z - np . max ( z ) ) <EOL> return ex / np . sum ( ex ) </s>
