SURE-tools 2.1.19__py3-none-any.whl → 2.1.20__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.
Potentially problematic release.
This version of SURE-tools might be problematic. Click here for more details.
- SURE/PerturbFlow.py +15 -11
- SURE/utils/custom_mlp.py +24 -0
- {sure_tools-2.1.19.dist-info → sure_tools-2.1.20.dist-info}/METADATA +1 -1
- {sure_tools-2.1.19.dist-info → sure_tools-2.1.20.dist-info}/RECORD +8 -8
- {sure_tools-2.1.19.dist-info → sure_tools-2.1.20.dist-info}/WHEEL +0 -0
- {sure_tools-2.1.19.dist-info → sure_tools-2.1.20.dist-info}/entry_points.txt +0 -0
- {sure_tools-2.1.19.dist-info → sure_tools-2.1.20.dist-info}/licenses/LICENSE +0 -0
- {sure_tools-2.1.19.dist-info → sure_tools-2.1.20.dist-info}/top_level.txt +0 -0
SURE/PerturbFlow.py
CHANGED
|
@@ -10,7 +10,7 @@ from torch.distributions.utils import logits_to_probs, probs_to_logits, clamp_pr
|
|
|
10
10
|
from torch.distributions import constraints
|
|
11
11
|
from torch.distributions.transforms import SoftmaxTransform
|
|
12
12
|
|
|
13
|
-
from .utils.custom_mlp import MLP, Exp
|
|
13
|
+
from .utils.custom_mlp import MLP, Exp, ZeroBiasMLP
|
|
14
14
|
from .utils.utils import CustomDataset, CustomDataset2, CustomDataset4, tensor_to_numpy, convert_to_tensor
|
|
15
15
|
|
|
16
16
|
|
|
@@ -196,16 +196,20 @@ class PerturbFlow(nn.Module):
|
|
|
196
196
|
if self.cell_factor_size>0:
|
|
197
197
|
self.cell_factor_effect = nn.ModuleList()
|
|
198
198
|
for i in np.arange(self.cell_factor_size):
|
|
199
|
-
self.cell_factor_effect.append(MLP(
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
)
|
|
199
|
+
#self.cell_factor_effect.append(MLP(
|
|
200
|
+
# [self.latent_dim+1] + hidden_sizes + [self.latent_dim],
|
|
201
|
+
# activation=activate_fct,
|
|
202
|
+
# output_activation=None,
|
|
203
|
+
# post_layer_fct=post_layer_fct,
|
|
204
|
+
# post_act_fct=post_act_fct,
|
|
205
|
+
# allow_broadcast=self.allow_broadcast,
|
|
206
|
+
# use_cuda=self.use_cuda,
|
|
207
|
+
# bias=False,
|
|
208
|
+
#)
|
|
209
|
+
#)
|
|
210
|
+
self.cell_factor_effect.append(ZeroBiasMLP(
|
|
211
|
+
self.latent_dim+1, hidden_sizes, self.latent_dim,
|
|
212
|
+
)
|
|
209
213
|
)
|
|
210
214
|
|
|
211
215
|
self.decoder_concentrate = MLP(
|
SURE/utils/custom_mlp.py
CHANGED
|
@@ -209,3 +209,27 @@ class MLP(nn.Module):
|
|
|
209
209
|
# pass through our sequential for the output!
|
|
210
210
|
def forward(self, *args, **kwargs):
|
|
211
211
|
return self.sequential_mlp.forward(*args, **kwargs)
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
class ZeroBiasMLP(nn.Module):
|
|
216
|
+
def __init__(self, input_dim, hidden_dims, output_dim):
|
|
217
|
+
super().__init__()
|
|
218
|
+
layers = []
|
|
219
|
+
dims = [input_dim] + hidden_dims + [output_dim]
|
|
220
|
+
|
|
221
|
+
# 构建线性层(强制所有偏置为0)
|
|
222
|
+
for i in range(len(dims)-1):
|
|
223
|
+
linear = nn.Linear(dims[i], dims[i+1])
|
|
224
|
+
nn.init.zeros_(linear.bias) # 初始化偏置为0
|
|
225
|
+
layers.append(linear)
|
|
226
|
+
if i < len(dims)-2:
|
|
227
|
+
layers.append(nn.ReLU()) # 激活函数
|
|
228
|
+
|
|
229
|
+
self.net = nn.Sequential(*layers)
|
|
230
|
+
|
|
231
|
+
def forward(self, x):
|
|
232
|
+
if type(x) == list:
|
|
233
|
+
x = torch.concat(x, dim=1)
|
|
234
|
+
return self.net(x)
|
|
235
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
SURE/PerturbFlow.py,sha256=
|
|
1
|
+
SURE/PerturbFlow.py,sha256=f0GUWbud-XDc3j0S3QKiRiUKr4cvtO9acoFyzMTH9eI,51151
|
|
2
2
|
SURE/SURE.py,sha256=6qjf9E9OMBkZQSNnmvornpEa4E203-_rtz5Hs8jNCJA,47472
|
|
3
3
|
SURE/SURE2.py,sha256=8wlnMwb1xuf9QUksNkWdWx5ZWq-xIy9NLx8RdUnE82o,48501
|
|
4
4
|
SURE/__init__.py,sha256=NOJI_K-eCqPgStXXvgl3wIEMp6d8saMTDYLJ7Ga9MqE,293
|
|
@@ -16,12 +16,12 @@ SURE/flow/quiver.py,sha256=_euFqSaRrDoZ_oOabOx20LOoUTJ__XPhLW-vzLNQfAo,1859
|
|
|
16
16
|
SURE/perturb/__init__.py,sha256=ouxShhbxZM4r5Gf7GmKiutrsmtyq7QL8rHjhgF0BU08,32
|
|
17
17
|
SURE/perturb/perturb.py,sha256=CqO3xPfNA3cG175tadDidKvGsTu_yKfJRRLn_93awKM,3303
|
|
18
18
|
SURE/utils/__init__.py,sha256=Htqv4KqVKcRiaaTBsR-6yZ4LSlbhbzutjNKXGD9-uds,660
|
|
19
|
-
SURE/utils/custom_mlp.py,sha256=
|
|
19
|
+
SURE/utils/custom_mlp.py,sha256=R63nhhRIO0sIEPwq7gAaBSDn5I5KMv7uDXsW6xEZXHw,7823
|
|
20
20
|
SURE/utils/queue.py,sha256=E_5PA5EWcBoGAZj8BkKQnkCK0p4C-4-xcTPqdIXaPXU,1892
|
|
21
21
|
SURE/utils/utils.py,sha256=IUHjDDtYaAYllCWsZyIzqQwaLul6fJRvHRH4vIYcR-c,8462
|
|
22
|
-
sure_tools-2.1.
|
|
23
|
-
sure_tools-2.1.
|
|
24
|
-
sure_tools-2.1.
|
|
25
|
-
sure_tools-2.1.
|
|
26
|
-
sure_tools-2.1.
|
|
27
|
-
sure_tools-2.1.
|
|
22
|
+
sure_tools-2.1.20.dist-info/licenses/LICENSE,sha256=TFHKwmrAViXQbSX5W-NDItkWFjm45HWOeUniDrqmnu0,1065
|
|
23
|
+
sure_tools-2.1.20.dist-info/METADATA,sha256=TWnbf7P62fec9iUnT2i8PZXuY9tMNL76_1uWS0j37rY,2651
|
|
24
|
+
sure_tools-2.1.20.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
25
|
+
sure_tools-2.1.20.dist-info/entry_points.txt,sha256=-nJI8rVe_qqrR0HmfAODzj-JNfEqCcSsyVh6okSqyHk,83
|
|
26
|
+
sure_tools-2.1.20.dist-info/top_level.txt,sha256=BtFTebdiJeqra4r6mm-uEtwVRFLZ_IjYsQ7OnalrOvY,5
|
|
27
|
+
sure_tools-2.1.20.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|