Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Initializing Model Weights and Biases | PyTorch Introduction
PyTorch Essentials

bookChallenge: Initializing Model Weights and Biases

Task

Swipe to start coding

You are tasked with creating random tensors to initialize weights and biases for a simple neural network.

  1. Ensure reproducibility by setting a manual seed to an arbitrary number before generating the tensors.
  2. Create a 3x4 tensor filled with random values from a uniform distribution between 0 and 1 (weights for the first layer).
  3. Create a 1x4 tensor filled with zeros (biases for the first layer).
  4. Create a 4x2 tensor with random integers between -5 and 5 (weights for the second layer).

Solution

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 1. ChapterΒ 6
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Suggested prompts:

Why is initializing weights with random integers not recommended?

What are better ways to initialize weights in practice?

Can you explain the potential issues with using random integers for weights?

close

Awesome!

Completion rate improved to 5

bookChallenge: Initializing Model Weights and Biases

Swipe to show menu

Task

Swipe to start coding

You are tasked with creating random tensors to initialize weights and biases for a simple neural network.

  1. Ensure reproducibility by setting a manual seed to an arbitrary number before generating the tensors.
  2. Create a 3x4 tensor filled with random values from a uniform distribution between 0 and 1 (weights for the first layer).
  3. Create a 1x4 tensor filled with zeros (biases for the first layer).
  4. Create a 4x2 tensor with random integers between -5 and 5 (weights for the second layer).

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

close

Awesome!

Completion rate improved to 5
SectionΒ 1. ChapterΒ 6
single

single

some-alt