Skip to content

Instantly share code, notes, and snippets.

@i-amgeek
Created March 6, 2020 06:57
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 i-amgeek/2a57b7daa6337de541e191a51aa6b955 to your computer and use it in GitHub Desktop.
Save i-amgeek/2a57b7daa6337de541e191a51aa6b955 to your computer and use it in GitHub Desktop.
Convolution Code
for filter in 0..num_filters
for channel in 0..input_channels
for out_h in 0..output_height
for out_w in 0..output_width
for k_h in 0..kernel_height
for k_w in 0..kernel_width
output[filter, out_h, out_w] +=
kernel[filter, channel, k_h, k_w] *
input[channel, out_h + k_h, out_w + k_w]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment