Created
October 11, 2019 16:51
-
-
Save vaibkumr/bb839e27adcc6cc7636ec37000930d1b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
batch1= torch.zeros(64, 3, 100, 100, names=('N', 'C', 'H', 'W')) | |
batch2 = torch.zeros(64, 3, 100, 100, names=('N', 'C', 'H', 'W')) | |
batch3 = torch.zeros(64, 3, 100, 100) | |
batch4 = torch.zeros(64, 3, 100, 100) | |
batch5 = torch.zeros(64, 3, 100, 100, names=('N', 'C', 'W', 'H')) | |
#Name tuple strings are equal so name matches | |
res1 = batch1 + batch2 | |
#Name of one of the inputs (batch3) is None so matches | |
res2 = batch1 + batch3 | |
#Name of both the inputs are None so matches | |
res2 = batch3 + batch4 | |
#Name tuple strings are not equal so no name match and error | |
res3 = batch1 + batch5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment