Tensor Axes and Shapes

A tensor shape records how many positions lie along each axis. Name axes separately so equal lengths do not hide different roles.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Trace a batch
  2. Prevent silent mismatches

Trace a batch

A shape \((4,3)\) can represent four examples with three features. Swapping its axes would put features first. The numerical dimensions alone cannot identify the task meaning. See row and column indices.

Prevent silent mismatches

Add a test where batch size differs from feature count so an accidental transpose changes the shape visibly. Tensor broadcasting contracts explain how some shape errors can otherwise appear to work.[1]

References

  1. Ian Goodfellow, Yoshua Bengio and Aaron Courville, Deep Learning ↩