Caffe2 - Python API
A deep learning, cross platform ML framework
remote_types.py
1 import torch
2 
3 from ..storage import _StorageBase
4 
5 
6 class _DistributedBase(object):
7  is_cuda = False
8  is_distributed = True
9 
10 
11 class DoubleStorage(_DistributedBase, torch._C.DistributedDoubleStorageBase, _StorageBase):
12  pass
13 
14 
15 class FloatStorage(_DistributedBase, torch._C.DistributedFloatStorageBase, _StorageBase):
16  pass
17 
18 
19 class LongStorage(_DistributedBase, torch._C.DistributedLongStorageBase, _StorageBase):
20  pass
21 
22 
23 class IntStorage(_DistributedBase, torch._C.DistributedIntStorageBase, _StorageBase):
24  pass
25 
26 
27 class ShortStorage(_DistributedBase, torch._C.DistributedShortStorageBase, _StorageBase):
28  pass
29 
30 
31 class CharStorage(_DistributedBase, torch._C.DistributedCharStorageBase, _StorageBase):
32  pass
33 
34 
35 class ByteStorage(_DistributedBase, torch._C.DistributedByteStorageBase, _StorageBase):
36  pass
37 
38 
39 class HalfStorage(_DistributedBase, torch._C.DistributedHalfStorageBase, _StorageBase):
40  pass
41 
42 
43 torch._storage_classes.add(DoubleStorage)
44 torch._storage_classes.add(FloatStorage)
45 torch._storage_classes.add(HalfStorage)
46 torch._storage_classes.add(LongStorage)
47 torch._storage_classes.add(IntStorage)
48 torch._storage_classes.add(ShortStorage)
49 torch._storage_classes.add(CharStorage)
50 torch._storage_classes.add(ByteStorage)
51 
52 
53 _type_names = ['Double', 'Float', 'Half', 'Long', 'Int', 'Short', 'Char', 'Byte']
54 _locals = locals()
55 _tensors = [_locals[t + 'Tensor'] for t in _type_names]
56 _storages = [_locals[t + 'Storage'] for t in _type_names]
57 for cls in _tensors + _storages:
58  cls.__module__ = 'torch.distributed.deprecated'
59 torch._C._init_names(_tensors + _storages)
60 del _locals, _type_names, _tensors, _storages