buffering the theano printed to access them later on.
Here there is an example for pymc3 where they do exactly that.
https://docs.pymc.io/notebooks/howto_debugging.html
Cleaning buffer
old_stdout = sys.stdout mystdout = sys.stdout = StringIO()
Computing model
gp.compute_model(geo_data)
Black magic update
sys.stdout = old_stdout
Split print strings
output = mystdout.getvalue().split('\n')
Init parameters
n_surface_op_float_sigmoid = [] n_surface_0 = [] n_surface_1 = [] a = [] b = [] drift = []
for s in output: if 'n_surface_op_float_sigmoid str' in s: n_surface_op_float_sigmoid.append(np.fromstring(s[s.find('[[')+2:-2], dtype='float', sep=' ')) if 'n_surface_0 str' in s: n_surface_0.append(np.fromstring(s[s.find('[[')+2:-2], dtype='float', sep=' ')) if 'n_surface_1 str' in s: n_surface_1.append(np.fromstring(s[s.find('[[')+2:-2], dtype='float', sep=' ')) if 'a str' in s: a.append(float(s[s.find('= ')+2:])) if 'b str' in s: b.append(float(s[s.find('= ')+2:])) if 'drift[slice_init:slice_init+1][0] str' in s: drift.append(np.fromstring(s[s.find('[[')+2:-2], dtype='float', sep=' '))
a, b, n_surface_0, n_surface_1, drift