0Pricing
Deep Learning Academy · บทเรียน

เซลล์ RNN แบบพื้นฐาน

ส่งต่อสถานะซ่อนเร้นข้ามแต่ละขั้น

เซลล์ RNN แบบพื้นฐาน เป็นบทเรียน Deep Learning Academy ฟรีบน CoddyKit นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Deep Learning Academy และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Deep Learning Academy มีบทเรียนทั้งหมด 4 บทเรียน

บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ

What a Cell Does

An RNN cell is the tiny engine that runs at each time step. You feed it one input and the old memory, and it returns the new memory.

Two Inputs Per Step

Every step the cell takes two things: the current input x and the previous hidden state. It mixes them into a fresh hidden state.

The Core Formula

The vanilla cell computes a weighted sum of input and memory, then squashes it. That single line is the heart of the RNN.

h_t = tanh(W_x @ x_t + W_h @ h_prev + b)

Why tanh?

The tanh activation keeps the hidden state bounded between -1 and 1, so memory values stay stable instead of blowing up over many steps.

Two Weight Matrices

One matrix W_x reads the new input; another W_h reads the old memory. The cell learns both to decide what to keep and what to add.

The Initial Hidden State

Before step one there is no memory, so the hidden state starts as a vector of zeros and gets filled in as the sequence flows through.

h0 = torch.zeros(hidden_size)

Unrolling Through Time

Picture the cell copied once per step, with memory passed along the chain. This view is called unrolling the network through time.

Outputs From Memory

Need a prediction at a step? Pass that step's hidden state through a small output layer to get logits or a value.

y_t = W_y @ h_t + b_y

Use It in PyTorch

PyTorch gives you nn.RNN so you don't hand-code the loop. You set input and hidden sizes, then feed a batched sequence.

rnn = nn.RNN(input_size=10, hidden_size=20)

Outputs and Final State

Calling the layer returns two things: the outputs at every step and the final hidden state, handy for classifying the whole sequence.

out, h_n = rnn(x)

The Catch

Vanilla RNNs work, but their memory fades fast over long sequences. That weakness sets the stage for gated cells like the LSTM.

Quick Check

What two things does a vanilla RNN cell take as input each step?

Recap

The vanilla cell blends input and old memory with tanh to make a new hidden state, repeated step by step across the sequence. ✅

คำถามที่พบบ่อย

บทเรียน “เซลล์ RNN แบบพื้นฐาน” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “เซลล์ RNN แบบพื้นฐาน” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Deep Learning Academy ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Deep Learning Academy มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “เซลล์ RNN แบบพื้นฐาน”

ส่งต่อสถานะซ่อนเร้นข้ามแต่ละขั้น คุณปฏิบัติ Deep Learning Academy ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Deep Learning Academy หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน Deep Learning Academy บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน

บทเรียน “เซลล์ RNN แบบพื้นฐาน” ใช้เวลานานแค่ไหน

บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย

ฉันเขียนและรันโค้ดในบทเรียน Deep Learning Academy นี้ได้ไหม

ได้ บทเรียน Deep Learning Academy ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

บทเรียนทั้งหมดในหลักสูตรนี้

  1. เหตุใดลำดับจึงต้องอาศัยหน่วยความจำ
  2. เซลล์ RNN แบบพื้นฐาน
  3. เกตของ LSTM และ GRU
  4. จัดแพ็กลำดับและรับมือกับแพดดิง
← กลับไปที่ Deep Learning Academy