C:\Users\i\Documents\lstm.py in bottom_data_is(self, x, s_prev, h_prev)
83 def bottom_data_is(self, x, s_prev = None, h_prev = None):
84 # if this is the first lstm node in the network
---> 85 if s_prev == None: s_prev = np.zeros_like(self.state.s)
86 if h_prev == None: h_prev = np.zeros_like(self.state.h)
87
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
if s_prev == None:
if np.any(s_prev == None):
if np.any(s_prev == None): s_prev = np.zeros_like(self.state.s)
---> 86 if np.any(h_prev == None): h_prev = np.zeros_like(self.state.h)
ValueError Traceback (most recent call last)
<ipython-input-5-c893fea1db45> in <module>()
47
48 if __name__ == "__main__":
---> 49 example_0()
50
51
<ipython-input-5-c893fea1db45> in example_0()
34 print("iter", "%2s" % str(cur_iter), end=": ")
35 for ind in range(len(y_list)):
---> 36 lstm_net.x_list_add(input_val_arr[ind])
37
38 print("y_pred = [" +
C:\Users\i\Documents\lstm.py in x_list_add(self, x)
191 s_prev = self.lstm_node_list[idx - 1].state.s
192 h_prev = self.lstm_node_list[idx - 1].state.h
--> 193 self.lstm_node_list[idx].bottom_data_is(x, s_prev, h_prev)
194
C:\Users\i\Documents\lstm.py in bottom_data_is(self, x, s_prev, h_prev)
84 # if this is the first lstm node in the network
85 if np.any(s_prev == None): s_prev = np.zeros_like(self.state.s)
---> 86 if np.any(h_prev == None): h_prev = np.zeros_like(self.state.h)
87
88
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Copyright©1996-2021,Tapuz Media Ltd. Forum software by XenForo® © 2010-2020 XenForo Ltd.