MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / load

Method load

rnn_class/rrnn_language.py:103–120  ·  view source on GitHub ↗
(filename, activation)

Source from the content-addressed store, hash-verified

101
102 @staticmethod
103 def load(filename, activation):
104 # TODO: would prefer to save activation to file too
105 npz = np.load(filename)
106 We = npz['arr_0']
107 Wx = npz['arr_1']
108 Wh = npz['arr_2']
109 bh = npz['arr_3']
110 h0 = npz['arr_4']
111 Wxz = npz['arr_5']
112 Whz = npz['arr_6']
113 bz = npz['arr_7']
114 Wo = npz['arr_8']
115 bo = npz['arr_9']
116 V, D = We.shape
117 _, M = Wx.shape
118 rnn = SimpleRNN(D, M, V)
119 rnn.set(We, Wx, Wh, bh, h0, Wxz, Whz, bz, Wo, bo, activation)
120 return rnn
121
122 def set(self, We, Wx, Wh, bh, h0, Wxz, Whz, bz, Wo, bo, activation):
123 self.f = activation

Callers 1

generate_poetryFunction · 0.45

Calls 2

setMethod · 0.95
SimpleRNNClass · 0.70

Tested by

no test coverage detected