rxnn 0.2.4__py3-none-any.whl → 0.2.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
rxnn/memory/stm.py
CHANGED
@@ -48,22 +48,23 @@ class ShortTermMemory(nn.Module):
|
|
48
48
|
if not self.is_trainable:
|
49
49
|
self.is_trainable = True
|
50
50
|
initial_stm = self.memory.clone()
|
51
|
-
|
51
|
+
delattr(self, 'memory')
|
52
52
|
self.memory = nn.Parameter(initial_stm)
|
53
53
|
|
54
54
|
def freeze(self):
|
55
55
|
if self.is_trainable:
|
56
56
|
self.requires_grad_(False)
|
57
57
|
trained_stm = self.memory.clone()
|
58
|
-
|
58
|
+
delattr(self, 'memory')
|
59
59
|
self.register_buffer('memory', trained_stm)
|
60
60
|
|
61
61
|
def reset(self, init_type: str = None):
|
62
|
-
self.memory
|
62
|
+
self.memory.copy_(self._init_tensor(init_type))
|
63
63
|
|
64
64
|
def resize(self, new_stm_size: int, init_type: str = None):
|
65
65
|
self.stm_size = new_stm_size
|
66
|
-
self
|
66
|
+
delattr(self, 'memory')
|
67
|
+
self.register_buffer('memory', self._init_tensor(init_type))
|
67
68
|
|
68
69
|
def batched_memory(self, batch_size: int, init_type: str = None):
|
69
70
|
if init_type is not None:
|
@@ -71,7 +72,8 @@ class ShortTermMemory(nn.Module):
|
|
71
72
|
'STM init type must be one of "normal", "standard", "uniform", "ones", "zeros"'
|
72
73
|
self.init_type = init_type
|
73
74
|
self.batch_size = batch_size
|
74
|
-
self
|
75
|
+
delattr(self, 'memory')
|
76
|
+
self.register_buffer('memory', self._init_tensor())
|
75
77
|
|
76
78
|
def single_memory(self, init_type: str = None, use_mean_from_batch: bool = False):
|
77
79
|
if init_type is not None:
|
@@ -81,7 +83,9 @@ class ShortTermMemory(nn.Module):
|
|
81
83
|
self.batch_size = 1
|
82
84
|
if use_mean_from_batch:
|
83
85
|
batch_mean = self.memory.mean(dim=(1, 2, 3), keepdim=True)
|
84
|
-
self
|
86
|
+
delattr(self, 'memory')
|
87
|
+
self.register_buffer('memory', self._init_tensor())
|
85
88
|
self.memory.copy_(batch_mean)
|
86
89
|
else:
|
87
|
-
self
|
90
|
+
delattr(self, 'memory')
|
91
|
+
self.register_buffer('memory', self._init_tensor())
|
@@ -7,7 +7,7 @@ rxnn/experimental/moe.py,sha256=jHZ1QhpWiVQOswVpFmuH7b2IUOPf0Uuf-I2Ddwsd7Us,6140
|
|
7
7
|
rxnn/memory/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
8
|
rxnn/memory/attention.py,sha256=p-r8DK3iVhNn-JAESVzIXDCG8gk1R_-x5xHclZ5jgb0,1813
|
9
9
|
rxnn/memory/norm.py,sha256=Ofl8Q5NYEF9GQeO0bhM43tkTW91J0y6TSvTAOYMgloM,6278
|
10
|
-
rxnn/memory/stm.py,sha256=
|
10
|
+
rxnn/memory/stm.py,sha256=DPkK1q1SLRw3HWM0dcvkn4XvIrfwUK47h4KmvFVWljc,3847
|
11
11
|
rxnn/rxt/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
12
|
rxnn/rxt/models.py,sha256=qlYgU002VE21ZOlcxEM9iv9tAvsbe4mngcMI2sw3j9k,12078
|
13
13
|
rxnn/training/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -32,7 +32,7 @@ rxnn/transformers/moe.py,sha256=j6jEx6Ip0zttlUZKKn82azxo95lkLZs-H2GLSMD88hY,5859
|
|
32
32
|
rxnn/transformers/positional.py,sha256=1PjcJybUzeQlIKJI4tahAGZcYgCRCL0otxs7mpsNuzM,4410
|
33
33
|
rxnn/transformers/sampler.py,sha256=2dpUQv88ekZa_CMSPLrXvB6X684wxUE2bDVznsi5ACs,17429
|
34
34
|
rxnn/utils.py,sha256=ihb6OTyDtPiocB_lOvnq7eOkjjpCkgs8wxvXUBNQ7mM,996
|
35
|
-
rxnn-0.2.
|
36
|
-
rxnn-0.2.
|
37
|
-
rxnn-0.2.
|
38
|
-
rxnn-0.2.
|
35
|
+
rxnn-0.2.5.dist-info/LICENSE,sha256=C8coDFIUYuOcke4JLPwTqahQUCyXyGq6WOaigOkx8tY,11275
|
36
|
+
rxnn-0.2.5.dist-info/METADATA,sha256=rfAJmz-On8W_e9tg8PVJ79-isZeBcv_3ejUkP2EcvA8,25959
|
37
|
+
rxnn-0.2.5.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
38
|
+
rxnn-0.2.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|