saving


checking out how to save current weight matrices and load them back in.


In [1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

first just checking that the flattening and reshaping works as expected



In [13]:
test = np.random.randn(11,11,4,100)
test.shape


Out[13]:
(11, 11, 4, 100)

In [14]:
test_flat = test.flatten()
test_flat.shape


Out[14]:
(48400,)

In [17]:
np.savetxt('test.txt', test_flat)
test_back = np.loadtxt('test.txt').reshape((11,11,4,100))
test_back.shape


Out[17]:
(11, 11, 4, 100)

In [18]:
np.mean(test - test_back)


Out[18]:
0.0

looks good.