Skip to content

Instantly share code, notes, and snippets.

@misho-kr
Forked from sailik1991/0.0 ML_DL_Resources.md
Created April 25, 2020 10:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save misho-kr/1337d006a7233b6089d3ee3150d64794 to your computer and use it in GitHub Desktop.
Save misho-kr/1337d006a7233b6089d3ee3150d64794 to your computer and use it in GitHub Desktop.
ML/DL Resources

CNN Layer

  • Conv2D
# Batch size = B
# Image height = h
# Image width = w
# Color channels = c

# (B, h, w, c)
x = Input(shape=(h, w, c))

# Convolution height = ch
# Convolution width = cw
# Convolution filters = f

# (B, h - ch, w - cw, f) <- (B, h, w, c)
x = Conv2D(filters=f, kernel_size=(ch, cw), stride=(1, 1))(x)
  • References: 1 2

LSTM layer

  • With return_sequences=True
# Batch size = B
# Timesteps = t
# Features = f

# (B, t, f)
x = Input(shape=(t, f))

# (B, t, out) <- (B, t, f)
x = LSTM(out, return_sequences=True, dropout = 0.5)(x)
  • With return_sequences=False
# (B, t, f)
x = Input(shape=(t, f))

# (B, out) <- (B, t, f)
x = LSTM(out, return_sequences=False, dropout = 0.5)(x)
  • References: 1 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment