1D convolution for neural networks, part 3: Sliding dot product equations longhand
Key Takeaways
The video discusses the mathematical implementation of 1D convolution for neural networks, specifically focusing on the sliding dot product equation and how to handle cases where the kernel does not fully overlap with the signal. It uses explicit pairwise multiplication and summation to calculate the convolution result.
Full Transcript
when we go to write out the values for our convolution result we can do this pairwise multiplication and summation explicitly we can write it out the long way so let's start by jumping kind of into the middle we'll look at Y of P so our result at the position P this means that our kernel fully overlaps the signal X so it goes from minus P 2 plus P and each one of those aligns with one element of the signal and in addition we know that the very tail end after we've flipped it the very left-hand side of that flipped kernel is W sub P we know that lines up exactly with the first value of our signal X sub 0 and we know that because we're calculating Y sub P the convolution at position P so by counting down from P to 0 we're counting our weights from 0 up to P and so we know that our first element is X sub 0 Y sub P and then we just step counting up on our X's and down on our w's because our W has been reversed our kernel has been reversed so we have X sub 1 times W of P minus 1 and we keep going until we get to the center of our kernel which is X sub P times what W sub 0 and then we keep going until we get to the far end of our kernel which is X sub 2 times P W sub minus P you can see there's a little typo here where I repeat the X sub P W sub 0 that shouldn't be there I'll change that but this shows going all the way from counting from WP to W minus B and from X sub 0 to X sub 2 P so this is a full fully overlapped a fully valid convolution as we step backward from here toward Y sub P minus 1 Y sub P minus 2 all the way back to Y sub 2 y sub 1 Y sub Z we get to a condition where our kernel does not completely overlap our signal some of its dangling off to the side the way we handle that mathematically is we pretend that our signal extends out further but that all of those values are zero but what that means is that we can safely ignore them in our equations because zero times each of the weights in our kernel is going to be zero and so we can always start with for y Sub Zero we can just start right in the middle of our kernel and say it's X sub zero times W sub zero and we can count up on our X index down on our W index because there are kernels been flipped X sub one times W minus one X sub 2 times W sub minus two all the way out to X sub P times W sub minus P then when we go to our next position Y sub one our next output value we just shift all of our weights by one but now we can include the W sub one time X sub zero and then move to X sub one times W sub zero and count all the way up to X sub P plus 1 and W sub minus P and we step through until we're completely overlapped at Y sub P and then we keep going we just increment our X index by one every time we increment our Y index by one and run that sliding dot product step by step all the way across and when we get to the far end we do the same thing than we did at the beginning any portion of the kernel that extends past the end of the signal just gets treated like it's lined up with zeros so each of those kernel elements get multiplied by zero so we can ignore them and then we keep going until that Center element on the kernel is lined up with the last element in our Y in our output array Y sub M and then that's our last value
Original Description
Part of an 9-part series on 1D convolution for neural networks.
Catch the rest at https://e2eml.school/321
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Brandon Rohrer · Brandon Rohrer · 49 of 60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
▶
50
51
52
53
54
55
56
57
58
59
60
Robot Learning with a Biologically-Inspired Brain (BECCA)
Brandon Rohrer
BECCA talk at AGI 2011
Brandon Rohrer
Robot Learning with a Biologically-Inspired Brain (BECCA), The Sequel
Brandon Rohrer
BECCA listens to The Hobbit
Brandon Rohrer
Learning the building blocks of speech: BECCA extracts a hierarchy of audio features
Brandon Rohrer
BECCA listens for sound effects in The Hobbit
Brandon Rohrer
BECCA finds movie trailers while watching the Big Bang Theory
Brandon Rohrer
Listening for unexpected sounds: BECCA detects anomalies in audio data
Brandon Rohrer
Learning the building blocks of vision: BECCA extracts a spatio-temporal hierarchy of features
Brandon Rohrer
Watching for the unexpected: BECCA detects anomalies in video data
Brandon Rohrer
BECCA finds a stationary target
Brandon Rohrer
BECCA finds a stationary target at 3X speed
Brandon Rohrer
BECCA watches the X-men and Bruce Lee
Brandon Rohrer
BECCA plays Quidditch
Brandon Rohrer
BECCA chases a ball
Brandon Rohrer
BECCA chases a ball, part 2
Brandon Rohrer
Becca chases a ball, part 3
Brandon Rohrer
BECCA creates features from MNIST
Brandon Rohrer
How reinforcement learning works in Becca 7
Brandon Rohrer
Deep Learning Demystified
Brandon Rohrer
How Data Science Works
Brandon Rohrer
How Convolutional Neural Networks work
Brandon Rohrer
How Bayes Theorem works
Brandon Rohrer
How Deep Neural Networks Work
Brandon Rohrer
Recurrent Neural Networks (RNN) and Long Short-Term Memory (LSTM)
Brandon Rohrer
How Support Vector Machines work / How to open a black box
Brandon Rohrer
How autocorrelation works
Brandon Rohrer
Getting closer to human intelligence through robotics
Brandon Rohrer
A minimalist's guide to slicing and indexing pandas DataFrames
Brandon Rohrer
How decision trees work
Brandon Rohrer
Data scientist archetypes
Brandon Rohrer
How to use python's datetime package
Brandon Rohrer
How optimization for machine learning works, part 1
Brandon Rohrer
How optimization for machine learning works, part 2
Brandon Rohrer
How optimization for machine learning works, part 3
Brandon Rohrer
How optimization for machine learning works, part 4
Brandon Rohrer
How convolutional neural networks work, in depth
Brandon Rohrer
How to pick a machine learning model 4: Splitting the data
Brandon Rohrer
How to pick a machine learning model 3: Choosing a loss function
Brandon Rohrer
How to pick a machine learning model 2: Separating signal from noise
Brandon Rohrer
How to pick a machine learning model 1: Choosing between models
Brandon Rohrer
How to pick a machine learning model 5: Navigating assumptions
Brandon Rohrer
What do neural networks learn?
Brandon Rohrer
Interview with iRobot's Director of Data Science Angela Bassa
Brandon Rohrer
How Backpropagation Works
Brandon Rohrer
Evolutionary Powell's method: A discrete optimizer for hyperparameter optimization
Brandon Rohrer
1D convolution for neural networks, part 1: Sliding dot product
Brandon Rohrer
1D convolution for neural networks, part 2: Convolution copies the kernel
Brandon Rohrer
1D convolution for neural networks, part 3: Sliding dot product equations longhand
Brandon Rohrer
1D convolution for neural networks, part 4: Convolution equation
Brandon Rohrer
1D convolution for neural networks, part 5: Backpropagation
Brandon Rohrer
1D convolution for neural networks, part 6: Input gradient
Brandon Rohrer
1D convolution for neural networks, part 7: Weight gradient
Brandon Rohrer
1D convolution for neural networks, part 8: Padding
Brandon Rohrer
1D convolution for neural networks, part 9: Stride
Brandon Rohrer
The Four Grand Challenges of Robots in the Home
Brandon Rohrer
How Convolution Works
Brandon Rohrer
The Softmax neural network layer
Brandon Rohrer
Batch normalization
Brandon Rohrer
Getting ready to learn Python, Mac edition #1: Files and directories
Brandon Rohrer
More on: ML Maths Basics
View skill →Related AI Lessons
⚡
⚡
⚡
⚡
I Compared 50 Python Courses. Here Are My Top 5 Recommendations for 2026
Medium · Python
Beyond the Elephant: On Manifolds, Projections, and the Hidden Assumptions of Neural Geometry
Medium · AI
Beyond the Elephant: On Manifolds, Projections, and the Hidden Assumptions of Neural Geometry
Medium · Data Science
Beyond the Elephant: On Manifolds, Projections, and the Hidden Assumptions of Neural Geometry
Medium · Deep Learning
🎓
Tutor Explanation
DeepCamp AI