()
| 30 | |
| 31 | |
| 32 | def get_batch(): |
| 33 | global BATCH_START, TIME_STEPS |
| 34 | # xs shape (50batch, 20steps) |
| 35 | xs = np.arange(BATCH_START, BATCH_START+TIME_STEPS*BATCH_SIZE).reshape((BATCH_SIZE, TIME_STEPS)) / (10*np.pi) |
| 36 | seq = np.sin(xs) |
| 37 | res = np.cos(xs) |
| 38 | BATCH_START += TIME_STEPS |
| 39 | # plt.plot(xs[0, :], res[0, :], 'r', xs[0, :], seq[0, :], 'b--') |
| 40 | # plt.show() |
| 41 | return [seq[:, :, np.newaxis], res[:, :, np.newaxis], xs] |
| 42 | |
| 43 | model = Sequential() |
| 44 | # build a LSTM RNN |
no outgoing calls
no test coverage detected