The existing code adds the fourth channel to the background image directly inside 'forward'. However, this breaks back propagation because Torch's autograd framework records the shapes of all inputs to the 'forward' function and expects shapes passed to 'backward' to match. By adding a channel to the background image inside 'forward' and passing this to 'backward', there is an extra channel that autograd does not expect, and it crashes.
The resolution is to instead raise an exception with a useful error message for the end user that they need to add a channel of all ones to the background image.
The existing code adds the fourth channel to the background image directly inside 'forward'. However, this breaks back propagation because Torch's autograd framework records the shapes of all inputs to the 'forward' function and expects shapes passed to 'backward' to match. By adding a channel to the background image inside 'forward' and passing this to 'backward', there is an extra channel that autograd does not expect, and it crashes.
The resolution is to instead raise an exception with a useful error message for the end user that they need to add a channel of all ones to the background image.
The svg parser will incorrectly parse colors such
as 'green' and 'red' to black. This commit fixes
that by using the code already written in matplotlib.colors
module