Add len to OrderedDict types (#21651)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/21651
ghimport-source-id: 0bba5c1930865e2d18b18782ba8c8990b0761d4d

Differential Revision: D15767795

Pulled By: bwasti

fbshipit-source-id: 70e27176897b0f977c9034ffb3ad21091c91e12e
diff --git a/torch/jit/__init__.py b/torch/jit/__init__.py
index dd04a58..7968393 100644
--- a/torch/jit/__init__.py
+++ b/torch/jit/__init__.py
@@ -1147,6 +1147,9 @@
     def values(self):
         return [v for k, v in self.items()]
 
+    def __len__(self):
+        return len(self.values())
+
     def __delitem__(self, k):
         raise RuntimeError("cannot delete methods or parameters of a script module")