Is there any way to draw a rectangle on a canvas in a way that is differentiable (i.e. can be backproped through)?
I am guessing something like would not be possible since indexing breaks backprop:
def draw_rect(canvas_tensor, x0, y0, x1, y1, color):
    canvas_tensor[..., y0:y1, x0:x1] = color

(where all parameters are trainable parameters)