Pytorch forward pass validation
Curated, evidence-grounded skill and software-tool collections for scientific AI agents, generated by the AgenticScienceBuilder
npx -y skills add HolobiomicsLab/asb-skill-collections --skill pytorch-forward-pass-validationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 14 stars14 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Use when after instantiating a PyTorch model (such as TransG-Net) with multimodal inputs (graph features and SMILES embeddings), and before beginning model training.
The file declares its own license as CC-BY-4.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
6.5 KB, ~1.0k tokens by cl100k_base, as published. Nobody here has run it
pytorch-forward-pass-validation
License: restricted — no clear open-source license detected for the underlying tool; verify licensing before commercial use or redistribution. <!-- asb-license-banner -->
Summary
Validate that a PyTorch neural network model accepts multimodal inputs and produces correctly-shaped output tensors by executing a forward pass with sample data. This skill ensures the model architecture is correctly instantiated and compatible with the data preparation pipeline before training.
When to use
After instantiating a PyTorch model (such as TransG-Net) with multimodal inputs (graph features and SMILES embeddings), and before beginning model training. Use this skill to verify that the model's forward pass executes without error and produces output tensors with expected dimensions matching the task's specification.
When NOT to use
- Model has already been validated and trained on the full dataset; forward pass validation is redundant at inference time.
- Input tensors are pre-validated through a separate automated test suite; manual forward pass validation is unnecessary.
- The model is already deployed in production and expected to handle dynamic batch sizes; static sample validation may not capture runtime edge cases.
Inputs
- Instantiated PyTorch model (nn.Module subclass)
- Sample multimodal input tensors (graph features as torch.Tensor)
- Sample multimodal input tensors (SMILES embeddings as torch.Tensor)
- Model architecture configuration (dict or config object)
Outputs
- Model forward pass execution result (torch.Tensor)
- Output tensor shape confirmation (tuple of integers)
- Model architecture summary (string)
- Parameter count statistics (integer)
- Input/output tensor dimension log (dict or file)
How to apply
First, generate or load sample multimodal input tensors consistent with the output format of the data preparation pipeline (e.g., molecular graphs and SMILES representations from data_prep.py). Instantiate the model with architecture parameters matching the multimodal input specification. Pass the sample inputs through the model by calling the forward pass (e.g., output = model(graph_input, smiles_input)). Verify that the forward pass completes without exceptions and that output tensor shapes match the expected dimensionality for the downstream task. Finally, log and record the model architecture summary, total parameter count, and input/output tensor dimensions for documentation and reproducibility.
Related tools
- torch (PyTorch framework for model instantiation, tensor operations, and forward pass execution)
- RDKit (Molecular graph feature extraction and SMILES embedding generation for multimodal input tensors)
- numpy (Numerical array operations for tensor shape inspection and dimension verification)
- CUDA (GPU acceleration for forward pass computation on large input tensors)
Examples
import torch
from TransGNet import TransGNet
model = TransGNet(input_dim=256, hidden_dim=128)
graph_sample = torch.randn(4, 50, 256)
smiles_sample = torch.randn(4, 100, 128)
output = model(graph_sample, smiles_sample)
print(f'Output shape: {output.shape}, Params: {sum(p.numel() for p in model.parameters())}')
Evaluation signals
- Forward pass executes without exceptions (RuntimeError, ValueError, or dimension mismatch errors).
- Output tensor shape matches expected specification (e.g., batch_size × num_classes or batch_size × embedding_dim).
- Model parameter count is consistent with paper specification or architectural design document.
- Input tensor dimensions are accepted by all model layers without shape broadcasting errors.
- Log records confirm model architecture summary and input/output tensor dimensions are logged successfully.
Limitations
- Forward pass validation on sample data does not guarantee convergence or performance on full training/test datasets.
- Sample tensor dimensions may not cover all edge cases (e.g., variable batch sizes, very large graphs, rare SMILES patterns).
- Validation does not verify gradient computation or backpropagation correctness; separate backward pass testing is required.
- CUDA memory constraints may not be apparent with small sample tensors; full-scale training may reveal OOM errors not caught here.
Evidence
- [methods] Model architecture and input specification: "Instantiate the TransG-Net model with the appropriate architecture parameters matching the multimodal input specification (graph features and SMILES embeddings)."
- [methods] Sample input generation: "Generate or load sample multimodal input tensors consistent with the output format of data_prep.py (molecular graphs and SMILES representations)."
- [methods] Forward pass execution: "Pass the sample inputs through the instantiated model to verify forward pass execution and output tensor shapes."
- [methods] Validation logging: "Log and record the model architecture summary, parameter count, and input/output tensor dimensions."
- [readme] Tool versions for forward pass: "torch >= 1.4.0 (please upgrade your torch version in order to reduce the training time)"
- [readme] Data preparation pipeline context: "the process of multimodal dataset production is in data_prep.py"
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.