dualmapref 0.2.8__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.
- args_parse.py +593 -0
- candidate_corrector.py +161 -0
- candidate_scorer.py +359 -0
- conformend/__init__.py +36 -0
- conformend/refiner.py +25 -0
- dataset/__init__.py +1 -0
- dataset/drugdataset.py +644 -0
- dataset/manifold.py +237 -0
- dataset/sharded_drugdataset.py +124 -0
- dataset/smiles2graph.py +217 -0
- dualmapref/__init__.py +24 -0
- dualmapref/refiner.py +16 -0
- dualmapref-0.2.8.dist-info/LICENSE +21 -0
- dualmapref-0.2.8.dist-info/METADATA +167 -0
- dualmapref-0.2.8.dist-info/RECORD +186 -0
- dualmapref-0.2.8.dist-info/WHEEL +5 -0
- dualmapref-0.2.8.dist-info/entry_points.txt +10 -0
- dualmapref-0.2.8.dist-info/top_level.txt +29 -0
- exputils.py +289 -0
- infer.py +23 -0
- infer_base_conformers.py +5589 -0
- infer_mean_dispersion_torsion.py +1117 -0
- infer_torsion.py +752 -0
- infer_torsional_denoiser.py +1021 -0
- manimol/__init__.py +30 -0
- manimol/__main__.py +6 -0
- manimol/cli.py +36 -0
- manimol/full_cli.py +41 -0
- manimol/legacy_imports.py +43 -0
- manimol/manifest.py +56 -0
- manimol/postprocess.py +148 -0
- manimol/priors.py +60 -0
- manimol/protocols.py +119 -0
- manimol/refiner.py +645 -0
- manimol/runtime.py +194 -0
- manimol/selection.py +85 -0
- manimol/torsion.py +22 -0
- manimol/train_cli.py +14 -0
- mixture_flow/src/__init__.py +1 -0
- mixture_flow/src/_path.py +7 -0
- mixture_flow/src/infer28_mixture_torsion_flow.py +1093 -0
- mixture_flow/src/mixture_torsion_flow.py +291 -0
- mixture_flow/src/summarize_mixture_debug.py +80 -0
- mixture_flow/src/train28_mixture_torsion_flow.py +583 -0
- mixture_torsion_flow.py +7 -0
- models/ manifold_learning.py +86 -0
- models/__init__.py +8 -0
- models/dist.py +273 -0
- models/dist2coords.py +23 -0
- models/egnn.py +107 -0
- models/experimental_backbones.py +364 -0
- models/gnnconv.py +512 -0
- models/kernel_inversion.py +141 -0
- models/kernels.py +427 -0
- models/losses.py +154 -0
- models/mean_dispersion_bridge.py +119 -0
- models/mean_dispersion_torsion_context.py +155 -0
- models/model.py +73 -0
- models/model0.py +2375 -0
- models/vis.py +128 -0
- pgraph_controls.py +107 -0
- scripts/__init__.py +2 -0
- scripts/analyze_basin_alignment.py +63 -0
- scripts/analyze_hif2a_conformer_aggregation.py +267 -0
- scripts/analyze_hif2a_contact_pharmacophore.py +1111 -0
- scripts/analyze_hif2a_fixed_budget.py +202 -0
- scripts/analyze_hif2a_pharmacophore.py +405 -0
- scripts/analyze_hif2a_pharmacophore_match_metric.py +386 -0
- scripts/analyze_p_control_candidate_flow.py +154 -0
- scripts/analyze_scaffold_basin.py +83 -0
- scripts/audit_dispersion_proposals.py +208 -0
- scripts/audit_etflow_protocol.py +258 -0
- scripts/audit_external_overlap.py +150 -0
- scripts/audit_oldbest_fulltrainval_split.py +82 -0
- scripts/audit_pdbbind_contact_pharmacophores.py +146 -0
- scripts/audit_qm9_geomol_test_split.py +94 -0
- scripts/audit_stage1_stage2_cross.py +131 -0
- scripts/build_geom_drugs_lowref_diagnostic.py +84 -0
- scripts/build_qm9_backfill_manifest.py +99 -0
- scripts/check_etflow_runtime.py +56 -0
- scripts/compare_prior_sources.py +122 -0
- scripts/compose_binding_mode_figure.py +87 -0
- scripts/compose_hif2a_contact_pharmacophore_suppfig.py +255 -0
- scripts/compose_hif2a_functional_geometry_pipeline.py +266 -0
- scripts/compose_manimol_internal_architecture.py +291 -0
- scripts/diagnose_flow_basin_intervention.py +54 -0
- scripts/diagnose_hif2a_pharmacophore_budget.py +185 -0
- scripts/diagnose_route2_p_ranking.py +123 -0
- scripts/discover_binding_mode_inputs.py +30 -0
- scripts/evaluate_functional_prior_stage1.py +230 -0
- scripts/evaluate_geomanimol.py +74 -0
- scripts/evaluate_geomanimol_flow.py +23 -0
- scripts/evaluate_geomanimol_multiscaffold.py +46 -0
- scripts/evaluate_geomanimol_residual.py +45 -0
- scripts/evaluate_geomanimol_torsion.py +40 -0
- scripts/evaluate_hif2a_bioactive_enrichment.py +91 -0
- scripts/evaluate_hif2a_pms_suite.py +440 -0
- scripts/evaluate_pdbbind_contact_pms.py +155 -0
- scripts/evaluate_platinum_external.py +114 -0
- scripts/evaluate_platinum_pool.py +82 -0
- scripts/evaluate_route2_calibrated_p.py +104 -0
- scripts/evaluate_route2_library_components.py +596 -0
- scripts/evaluate_route2_p_basin_budget.py +288 -0
- scripts/evaluate_stage1_checkpoint_only.py +30 -0
- scripts/export_dispersion_bond_audit.py +136 -0
- scripts/export_top20_shards.py +207 -0
- scripts/external_validation_metrics.py +152 -0
- scripts/fit_topology_prior.py +117 -0
- scripts/frozen_dispersion_audit.py +281 -0
- scripts/geomanimol_debug.py +50 -0
- scripts/geomanimol_smoke.py +37 -0
- scripts/infer_etflow_matched.py +524 -0
- scripts/inspect_checkpoint.py +12 -0
- scripts/inspect_conformer_capacity.py +71 -0
- scripts/inspect_pool.py +12 -0
- scripts/make_figure3_selection_loss.py +474 -0
- scripts/make_figure3_selection_summary.py +275 -0
- scripts/make_geom_debug_subset.py +62 -0
- scripts/make_low_reference_test_subset.py +70 -0
- scripts/merge_stage1_into_stage2.py +82 -0
- scripts/place_hif2a_candidates_for_evaluation.py +66 -0
- scripts/plot_hif2a_low_budget_efficiency.py +100 -0
- scripts/plot_prior_validation.py +48 -0
- scripts/precompute_stage2_assignments.py +90 -0
- scripts/prepare_bace_activity.py +98 -0
- scripts/prepare_bace_etkdg_benchmark.py +90 -0
- scripts/prepare_figure5_4x4_cases.py +470 -0
- scripts/prepare_geom_drugs_geomol_top20.py +472 -0
- scripts/prepare_pdbbind_core_raw.py +90 -0
- scripts/prepare_platinum_raw.py +74 -0
- scripts/prepare_pubchem_etkdg.py +54 -0
- scripts/rebuild_hif2a_final_sdf_and_metrics.py +55 -0
- scripts/rebuild_hif2a_fixed_pool_sweep.py +175 -0
- scripts/rebuild_hif2a_strict.py +220 -0
- scripts/recompute_hif2a_bootstrap.py +63 -0
- scripts/reference_free_geometry.py +112 -0
- scripts/render_binding_modes.py +413 -0
- scripts/render_figure5_4x4.py +330 -0
- scripts/render_figure6_pharmacophore_pymol.py +162 -0
- scripts/render_hif2a_contact_pharmacophore_pymol.py +414 -0
- scripts/render_hif2a_figure11.py +397 -0
- scripts/run_bace_2d_baseline.py +73 -0
- scripts/run_drugs_validation_matrix.py +225 -0
- scripts/run_external_reference_free.py +53 -0
- scripts/run_manimol_finalk_sensitivity.py +106 -0
- scripts/run_manimol_oversampling_sensitivity.py +109 -0
- scripts/run_pdisp_matched_intervention.py +116 -0
- scripts/run_stage1_stage2_cross20.py +83 -0
- scripts/score_hif2a_candidates_with_pgraph.py +221 -0
- scripts/summarize_dispersion_intervention.py +88 -0
- scripts/test_mean_dispersion_bridge.py +50 -0
- scripts/train_dispersion_head_diagnostic.py +320 -0
- scripts/train_dispersion_head_streaming.py +519 -0
- scripts/train_geomanimol.py +100 -0
- scripts/train_geomanimol_flow.py +26 -0
- scripts/train_geomanimol_residual.py +70 -0
- scripts/train_geomanimol_torsion.py +50 -0
- scripts/train_quantile_representation_diagnostic.py +204 -0
- scripts/validate_mean_dispersion_prior.py +173 -0
- scripts/validate_packed_shard.py +41 -0
- scripts/validate_stage1_prior.py +221 -0
- scripts/validate_top20_shards.py +36 -0
- scripts/validation/__init__.py +1 -0
- scripts/validation/hif2a_downstream_baselines.py +105 -0
- scripts/validation/hif2a_pairwise_ranker.py +218 -0
- scripts/verify_binding_mode_figure.py +47 -0
- torsion_manifold.py +281 -0
- train.py +78 -0
- train_graph_encoder.py +206 -0
- train_local_torsion_corrector.py +511 -0
- train_mean_dispersion_torsion_prior.py +329 -0
- train_probability_basin.py +235 -0
- train_torsion_generator.py +1631 -0
- train_torsion_manifold_prior.py +258 -0
- train_torsional_denoiser.py +415 -0
- trainer.py +1038 -0
- utils/__init__.py +7 -0
- utils/checkpoint.py +40 -0
- utils/device.py +17 -0
- utils/helpers.py +98 -0
- utils/kabsch.py +29 -0
- utils/lookup_table.py +164 -0
- utils/metrics.py +50 -0
- utils/optuna.py +111 -0
- utils/save_mol.py +366 -0
- utils/util.py +36 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"""Interpretable bridge from pairwise mean--dispersion priors to torsions."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import torch
|
|
6
|
+
|
|
7
|
+
from models.model0 import _torsion_rows
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def controlled_dispersion_for_width(dispersion_prior: torch.Tensor, args) -> torch.Tensor:
|
|
11
|
+
"""Apply a matched intervention to the dispersion map used for widths.
|
|
12
|
+
|
|
13
|
+
``constant`` preserves the molecule-level off-diagonal mean while removing
|
|
14
|
+
pair-specific structure. ``shuffle`` preserves the upper-triangular
|
|
15
|
+
marginal exactly while breaking pair correspondence and reconstructing a
|
|
16
|
+
symmetric map. Both controls leave the diagonal at zero.
|
|
17
|
+
"""
|
|
18
|
+
if dispersion_prior is None:
|
|
19
|
+
return None
|
|
20
|
+
mode = str(getattr(args, "dispersion_control", "normal") or "normal").lower()
|
|
21
|
+
if mode == "normal":
|
|
22
|
+
return dispersion_prior
|
|
23
|
+
if dispersion_prior.dim() != 2 or dispersion_prior.size(0) != dispersion_prior.size(1):
|
|
24
|
+
raise ValueError("dispersion_prior must be square")
|
|
25
|
+
n = dispersion_prior.size(0)
|
|
26
|
+
eye = torch.eye(n, dtype=torch.bool, device=dispersion_prior.device)
|
|
27
|
+
off_diag = ~eye
|
|
28
|
+
if mode == "constant":
|
|
29
|
+
values = dispersion_prior[off_diag]
|
|
30
|
+
constant = values.mean() if values.numel() else dispersion_prior.new_zeros(())
|
|
31
|
+
return torch.where(off_diag, constant.expand_as(dispersion_prior), torch.zeros_like(dispersion_prior))
|
|
32
|
+
if mode not in {"shuffle", "random"}:
|
|
33
|
+
raise ValueError(f"Unknown dispersion_control={mode!r}")
|
|
34
|
+
seed = int(getattr(args, "dispersion_seed", 20260913))
|
|
35
|
+
seed = (seed + int(dispersion_prior.numel()) * 1013 + int(dispersion_prior.shape[0]) * 9176) % (2**31 - 1)
|
|
36
|
+
generator = torch.Generator(device=dispersion_prior.device)
|
|
37
|
+
generator.manual_seed(seed)
|
|
38
|
+
upper = torch.triu_indices(n, n, offset=1, device=dispersion_prior.device)
|
|
39
|
+
values = dispersion_prior[upper[0], upper[1]]
|
|
40
|
+
if mode == "shuffle":
|
|
41
|
+
values = values[torch.randperm(values.numel(), generator=generator, device=values.device)]
|
|
42
|
+
else:
|
|
43
|
+
# Match the learned empirical marginal exactly, but independently
|
|
44
|
+
# randomize pair assignment; this is an auxiliary control.
|
|
45
|
+
values = values[torch.randperm(values.numel(), generator=generator, device=values.device)]
|
|
46
|
+
shuffled = torch.zeros_like(dispersion_prior)
|
|
47
|
+
shuffled[upper[0], upper[1]] = values
|
|
48
|
+
shuffled[upper[1], upper[0]] = values
|
|
49
|
+
return shuffled
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def _symmetric(matrix: torch.Tensor, upper: float) -> torch.Tensor:
|
|
53
|
+
matrix = torch.as_tensor(matrix)
|
|
54
|
+
if matrix.dim() != 2 or matrix.size(0) != matrix.size(1):
|
|
55
|
+
raise ValueError("pairwise prior must be square")
|
|
56
|
+
if not torch.isfinite(matrix).all():
|
|
57
|
+
raise ValueError("pairwise prior contains non-finite values")
|
|
58
|
+
matrix = 0.5 * (matrix + matrix.t())
|
|
59
|
+
matrix = matrix.clamp(0.0, upper)
|
|
60
|
+
return matrix.masked_fill(torch.eye(matrix.size(0), dtype=torch.bool, device=matrix.device), 0.0)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def masked_context_pool(context: torch.Tensor, valid_mask: torch.Tensor) -> torch.Tensor:
|
|
64
|
+
"""Pool torsion contexts while excluding padded/invalid torsion rows."""
|
|
65
|
+
if context.dim() == 2:
|
|
66
|
+
context = context.unsqueeze(0)
|
|
67
|
+
if valid_mask.dim() == 1:
|
|
68
|
+
valid_mask = valid_mask.unsqueeze(0)
|
|
69
|
+
if context.dim() != 3 or valid_mask.shape != context.shape[:2]:
|
|
70
|
+
raise ValueError("context and valid_mask shapes are incompatible")
|
|
71
|
+
weights = valid_mask.to(dtype=context.dtype).unsqueeze(-1)
|
|
72
|
+
return (context * weights).sum(dim=1) / weights.sum(dim=1).clamp_min(1.0)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def mean_dispersion_torsion_context(mean_prior, dispersion_prior, mol, torsion_index, max_torsions):
|
|
76
|
+
"""Return [mean(mu), mean(v), q90(mu), max(mu)] for each bond cut."""
|
|
77
|
+
mean_prior = _symmetric(mean_prior, 1.0)
|
|
78
|
+
dispersion_prior = _symmetric(dispersion_prior, 0.25)
|
|
79
|
+
if mean_prior.shape != dispersion_prior.shape:
|
|
80
|
+
raise ValueError("mean and dispersion priors must have matching shapes")
|
|
81
|
+
context = torch.zeros(int(max_torsions), 4, dtype=mean_prior.dtype, device=mean_prior.device)
|
|
82
|
+
valid = torch.zeros(int(max_torsions), dtype=torch.bool, device=mean_prior.device)
|
|
83
|
+
rows = _torsion_rows(torsion_index)
|
|
84
|
+
if mol is None or rows is None or rows.numel() == 0:
|
|
85
|
+
return context, valid
|
|
86
|
+
|
|
87
|
+
n_atoms = min(int(mean_prior.size(0)), int(mol.GetNumAtoms()))
|
|
88
|
+
adjacency = [[] for _ in range(n_atoms)]
|
|
89
|
+
for bond in mol.GetBonds():
|
|
90
|
+
left, right = int(bond.GetBeginAtomIdx()), int(bond.GetEndAtomIdx())
|
|
91
|
+
if left < n_atoms and right < n_atoms:
|
|
92
|
+
adjacency[left].append(right)
|
|
93
|
+
adjacency[right].append(left)
|
|
94
|
+
for index, row in enumerate(rows[: int(max_torsions)]):
|
|
95
|
+
cut_left, cut_right = int(row[1]), int(row[2])
|
|
96
|
+
if min(cut_left, cut_right) < 0 or max(cut_left, cut_right) >= n_atoms:
|
|
97
|
+
continue
|
|
98
|
+
stack, left_atoms = [cut_left], {cut_left}
|
|
99
|
+
while stack:
|
|
100
|
+
atom = stack.pop()
|
|
101
|
+
for neighbor in adjacency[atom]:
|
|
102
|
+
if {atom, neighbor} == {cut_left, cut_right} or neighbor in left_atoms:
|
|
103
|
+
continue
|
|
104
|
+
left_atoms.add(neighbor)
|
|
105
|
+
stack.append(neighbor)
|
|
106
|
+
right_atoms = [atom for atom in range(n_atoms) if atom not in left_atoms]
|
|
107
|
+
if not left_atoms or not right_atoms:
|
|
108
|
+
continue
|
|
109
|
+
left = torch.tensor(sorted(left_atoms), dtype=torch.long, device=mean_prior.device)
|
|
110
|
+
right = torch.tensor(right_atoms, dtype=torch.long, device=mean_prior.device)
|
|
111
|
+
mu = mean_prior[left][:, right].reshape(-1)
|
|
112
|
+
disp = dispersion_prior[left][:, right].reshape(-1)
|
|
113
|
+
context[index] = torch.stack((mu.mean(), disp.mean(), torch.quantile(mu, 0.90), mu.max()))
|
|
114
|
+
valid[index] = True
|
|
115
|
+
return context, valid
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def dispersion_torsion_widths(
|
|
119
|
+
dispersion_prior,
|
|
120
|
+
mol,
|
|
121
|
+
torsion_index,
|
|
122
|
+
max_torsions,
|
|
123
|
+
scale=0.35,
|
|
124
|
+
min_width=0.5,
|
|
125
|
+
max_width=2.0,
|
|
126
|
+
):
|
|
127
|
+
"""Map pairwise dispersion to bounded per-torsion proposal widths.
|
|
128
|
+
|
|
129
|
+
The score for a rotatable bond is the mean ``P_disp`` value across the
|
|
130
|
+
two fragments created by cutting that bond. Scores are standardized
|
|
131
|
+
within a molecule and converted to a bounded log-width, so the geometric
|
|
132
|
+
mean width is approximately one and candidate counts are unchanged.
|
|
133
|
+
"""
|
|
134
|
+
if dispersion_prior is None:
|
|
135
|
+
return torch.ones(int(max_torsions)), torch.zeros(int(max_torsions)), torch.zeros(
|
|
136
|
+
int(max_torsions), dtype=torch.bool
|
|
137
|
+
)
|
|
138
|
+
zero_mean = torch.zeros_like(dispersion_prior)
|
|
139
|
+
context, valid = mean_dispersion_torsion_context(
|
|
140
|
+
zero_mean,
|
|
141
|
+
dispersion_prior,
|
|
142
|
+
mol,
|
|
143
|
+
torsion_index,
|
|
144
|
+
max_torsions,
|
|
145
|
+
)
|
|
146
|
+
scores = context[:, 1]
|
|
147
|
+
widths = torch.ones_like(scores)
|
|
148
|
+
if int(valid.sum().item()) >= 2:
|
|
149
|
+
valid_scores = scores[valid]
|
|
150
|
+
center = valid_scores.median()
|
|
151
|
+
spread = (valid_scores - center).abs().median().clamp_min(1e-6)
|
|
152
|
+
z = (scores - center) / (2.0 * spread)
|
|
153
|
+
widths = torch.exp(float(scale) * z).clamp(float(min_width), float(max_width))
|
|
154
|
+
widths = torch.where(valid, widths, torch.ones_like(widths))
|
|
155
|
+
return widths, scores, valid
|
models/model.py
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import torch
|
|
2
|
+
from torch import nn
|
|
3
|
+
import torch.nn.functional as F
|
|
4
|
+
from torch_geometric.nn import global_mean_pool,global_add_pool,global_max_pool
|
|
5
|
+
from torch_scatter import scatter_add, scatter_mean
|
|
6
|
+
import numpy as np
|
|
7
|
+
from .gnnconv import GNN_node,MLP
|
|
8
|
+
from torch_geometric.utils import to_scipy_sparse_matrix
|
|
9
|
+
from scipy.sparse.csgraph import shortest_path
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def compute_high_dim_adj(edge_index: torch.LongTensor,
|
|
13
|
+
num_nodes: int,
|
|
14
|
+
sigma_H: float) -> torch.Tensor:
|
|
15
|
+
|
|
16
|
+
#
|
|
17
|
+
A = to_scipy_sparse_matrix(edge_index, num_nodes=num_nodes) # shape [N,N]
|
|
18
|
+
#
|
|
19
|
+
dist_matrix = shortest_path(A, directed=False, unweighted=True) # numpy [N,N]
|
|
20
|
+
# 3.
|
|
21
|
+
W = np.exp(- dist_matrix / sigma_H)
|
|
22
|
+
# turn to torch.Tensor
|
|
23
|
+
return torch.from_numpy(W).float()
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def compute_low_dim_adj(pos: torch.Tensor,
|
|
27
|
+
sigma_L: float) -> torch.Tensor:
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
diff = pos.unsqueeze(1) - pos.unsqueeze(0) # [N,1,D] - [1,N,D] -> [N,N,D]
|
|
31
|
+
dist = diff.norm(dim=-1) # [N,N]
|
|
32
|
+
|
|
33
|
+
W = torch.exp(- dist / sigma_L)
|
|
34
|
+
return W
|
|
35
|
+
|
|
36
|
+
class GNNEncoder(nn.Module):
|
|
37
|
+
def __init__(self, args, config):
|
|
38
|
+
super(GNNEncoder, self).__init__()
|
|
39
|
+
self.args = args
|
|
40
|
+
self.config = config
|
|
41
|
+
emb_dim = args.emb_dim
|
|
42
|
+
self.gnn = GNN_node(num_layer=args.layer, emb_dim=args.emb_dim,
|
|
43
|
+
drop_ratio=args.dropout, gnn_type=args.gnn_type)
|
|
44
|
+
self.mlp =MLP(input_dim=emb_dim, hidden_dim=args.mlp_hidden, output_dim=3,num_layers=args.mlp_layer)
|
|
45
|
+
if args.pooling_type == 'mean':
|
|
46
|
+
self.pool = global_mean_pool
|
|
47
|
+
elif args.pooling_type == 'add':
|
|
48
|
+
self.pool = global_add_pool
|
|
49
|
+
elif args.pooling_type =='max':
|
|
50
|
+
self.pool = global_max_pool
|
|
51
|
+
else:
|
|
52
|
+
raise ValueError(f"Unknown pooling method: {args.pooling_type}")
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def forward(self, data):
|
|
56
|
+
node_feat = self.gnn(data)
|
|
57
|
+
graph_feat = self.pool(node_feat, data.batch)
|
|
58
|
+
W_H = compute_high_dim_adj(data.edge_index, data.num_nodes, self.args.sigma_H)
|
|
59
|
+
|
|
60
|
+
#print(f"node_feat shape: {node_feat.shape}")
|
|
61
|
+
|
|
62
|
+
pred_pos = self.mlp(node_feat)
|
|
63
|
+
W_L = compute_low_dim_adj(pred_pos, self.args.sigma_L)
|
|
64
|
+
|
|
65
|
+
#print(f"data.pos shape: {data.pos.shape}")
|
|
66
|
+
#print(f"pred_pos shape: {pred_pos.shape}")
|
|
67
|
+
|
|
68
|
+
pos_loss = F.mse_loss(pred_pos, data.pos) # pos_pred, pos_true: [N, 3]
|
|
69
|
+
device = node_feat.device # or data.x.device
|
|
70
|
+
W_H = W_H.to(device)
|
|
71
|
+
W_L = W_L.to(device)
|
|
72
|
+
mani_loss= torch.sum((W_H - W_L) ** 2)
|
|
73
|
+
return pred_pos, graph_feat, pos_loss,mani_loss
|