Skip to content

Commit

Permalink
Merge pull request #1 from msethi006/feature-#454
Browse files Browse the repository at this point in the history
Update sample.py
  • Loading branch information
msethi006 authored Aug 24, 2021
2 parents 92c167d + d55931e commit db75c9d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mmf/common/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@ def __init__(self, samples=None):

if isinstance(samples[0][field], collections.abc.Mapping):
self[field] = SampleList(self[field])
def __eq__(self,other):
if self.keys() != other.keys():
return False
for i in self.keys():
if type(self[i])==torch.Tensor and type(other[i])==torch.Tensor:
if torch.equal(self[i], other[i]) == False:
return False
return True

def _check_and_load_tuple(self, samples):
if isinstance(samples[0], (tuple, list)) and isinstance(samples[0][0], str):
Expand Down

0 comments on commit db75c9d

Please sign in to comment.