MCPcopy Create free account
hub / github.com/MorvanZhou/tutorials / get_batch

Function get_batch

tensorflowTUT/tf20_RNN2.2/full_code.py:25–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23
24
25def get_batch():
26 global BATCH_START, TIME_STEPS
27 # xs shape (50batch, 20steps)
28 xs = np.arange(BATCH_START, BATCH_START+TIME_STEPS*BATCH_SIZE).reshape((BATCH_SIZE, TIME_STEPS)) / (10*np.pi)
29 seq = np.sin(xs)
30 res = np.cos(xs)
31 BATCH_START += TIME_STEPS
32 # plt.plot(xs[0, :], res[0, :], 'r', xs[0, :], seq[0, :], 'b--')
33 # plt.show()
34 # returned seq, res and xs: shape (batch, step, input)
35 return [seq[:, :, np.newaxis], res[:, :, np.newaxis], xs]
36
37
38class LSTMRNN(object):

Callers 1

full_code.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected