Exercises

These exercises check the shape habits from the chapter. Work them without a framework.

DL-C01-C-001Exercise: Vector shape

A vector has 9 entries. What is its shape size?

Compute it first, then check your number.

DL-C01-C-002Exercise: Matrix dimensions

A matrix has 7 rows and 4 columns. Enter its shape as a vector.

Compute it first, then check your number.

DL-C01-C-003Exercise: Batch size

An input batch has shape (32, 12). Rows are examples. What is the batch size?

Compute it first, then check your number.

DL-C01-C-004Exercise: Feature count

An input batch has shape (32, 12). Columns are features. How many features does each example have?

Compute it first, then check your number.

DL-C01-C-005Exercise: Layer output shape

Let X have shape (6, 5) and W have shape (5, 2). Enter the shape of XW.

Compute it first, then check your number.

DL-C01-C-006Exercise: Shape mismatch

Let X have shape (6, 5) and W have shape (4, 2). Enter 1 if XW is valid, or 0 if it is not.

Compute it first, then check your number.

DL-C01-C-007Exercise: Axis meaning

A tensor has shape (3, 7, 16) and means (batch, positions, features). How many features does each position have?

Compute it first, then check your number.

DL-C01-C-008Exercise: Reshape check

Can shape (2, 6) be reshaped into (3, 4) without changing the number of entries? Enter 1 for yes or 0 for no.

Compute it first, then check your number.

DL-C01-C-009Exercise: Broadcasted bias

X has shape (9, 5) and b has shape (5). What is the shape of X + b?

Compute it first, then check your number.

DL-C01-C-010Exercise: Layer parameter shape

A layer maps 12 input features to 6 output features. What shape should W have in (input_features, output_features) order?

Compute it first, then check your number.