Skip to content

Instantly share code, notes, and snippets.

@3h4
Created November 18, 2016 14:31
Show Gist options
  • Save 3h4/a9bdf7f465595e151c1c7919691c560f to your computer and use it in GitHub Desktop.
Save 3h4/a9bdf7f465595e151c1c7919691c560f to your computer and use it in GitHub Desktop.
def generateData():
x = np.array(np.random.choice(2, total_series_length, p=[0.5, 0.5]))
y = np.roll(x, echo_step)
y[0:echo_step] = 0
x = x.reshape((batch_size, -1)) # The first index changing slowest, subseries as rows
y = y.reshape((batch_size, -1))
return (x, y)
@orian
Copy link

orian commented May 12, 2017

zeroing all beginnings

def generateData():
    x = np.array(np.random.choice(2, total_series_length, p=[0.5, 0.5]))
    y = np.roll(x, echo_step)

    x = x.reshape((batch_size, -1))  # The first index changing slowest, subseries as rows
    y = y.reshape((batch_size, -1))
    y[:,:echo_step] = 0

    return (x, y)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment