Skip to content

Random Block Problem


Create a 10x10 tensor of 32-bit integers filled with zeros. Then select a random 3x3 block inside the tensor and switch the values from 0 to 1.

Bonus
You can interpret this tensor as an image where 0s represent black pixels and 1s represent white pixels. Plot the image.


Try with Google Colab See the solution