Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new abstract base class LayoutTransform that defines the interface for transforming application-level tensor data (Inputs, Inouts, Outputs) into contiguous model inputs and vice versa. This abstraction allows the AMS pipeline to remain agnostic about data layout while delegating all shape and packing logic to concrete implementations.
- Adds
LayoutTransformabstract base class withpack(),unpack(), andname()methods - Provides comprehensive unit tests with a dummy implementation to verify the interface
- Integrates the new test into the CMake build system
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/AMSlib/wf/layout_transform.hpp | Defines the abstract LayoutTransform interface for data transformation between application and model formats |
| tests/AMSlib/wf/layout_transform.cpp | Implements test cases covering the three interface methods using a dummy transform implementation |
| tests/AMSlib/wf/CMakeLists.txt | Adds build configuration for the new layout_transform test executable |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| void unpack(const torch::jit::IValue& iv, | ||
| ams::TensorBundle& Outputs, | ||
| ams::TensorBundle& Inouts, | ||
| std::optional<at::Tensor>& Uncertainties) override | ||
| { | ||
| // Expect a tuple of 2 tensors | ||
| auto tup = iv.toTuple(); | ||
| auto pred = tup->elements()[0].toTensor(); | ||
| auto uncrt = tup->elements()[1].toTensor(); | ||
|
|
||
| // Output bundle receives the prediction | ||
| Outputs.add("pred", pred); | ||
|
|
There was a problem hiding this comment.
The unpack() method signature includes an Inouts parameter that can be modified by implementations. However, the test coverage only verifies Outputs and Uncertainties. Consider adding a test case that verifies Inouts can be properly modified by unpack(), similar to how other test files in this directory comprehensively test all functionality.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.