Skip to content
ml-recall

#pytorch

32 questions from Information Theory, Logistic Regression & Softmax, Neural Network Basics, Training Deep Networks, Deep Learning Frameworks, Convolutional Neural Networks, Recurrent Neural Networks, Attention & Transformers, Transfer Learning, Autoencoders & VAEs, Diffusion Models, Fine-tuning & PEFT, Alignment & Reasoning, PyTorch

Timed test

20 questions · 20 min · score and explanations at the end

Longer test or by difficulty: mixed test with #pytorch

Take a test
Q 1 / 32Score 0 / 0

Question 1: Short answer

mediumAI-checkedInformation Theory

This is the d2l entropy function. What does the last line return?

import torch

def nansum(x):
    return x[~torch.isnan(x)].sum()

def entropy(p):
    return nansum(-p * torch.log2(p))

entropy(torch.tensor([0.5, 0.25, 0.25, 0.0]))

a number (bits)