ValueError: Target size (torch.Size([16])) must be the same as input size (torch.Size([16, 1]))

target = target.unsqueeze(1), before passing target to criterion, changed the target tensor size from [16] to [16,1]. Doing it solved the issue. Furthermore, I also needed to do target = target.float() before passing it to criterion, because our outputs are in float. Besides, there was another error in the code. I was using sigmoid activation … Read more

size of node with shape=circle

From the DOT Guide http://www.graphviz.org/pdf/dotguide.pdf on page 4 it says the following: When drawn, a node’s actual size is the greater of the requested size and the area needed for its text label, unless fixedsize=true, in which case the width and height values are enforced. Thus you simply need to add fixedsize=true to your code