Skip to content

Conversation

@Koolvansh07
Copy link

Pull Request

Description

This PR addresses issue #190 by adding explicit input validation to the forward methods of GraphWeatherForecaster, GraphWeatherAssimilator, and AuroraModel.

The models now strictly enforce that input feature tensors must be 3-dimensional with the shape [batch, nodes, features]. Previously, invalid input shapes (e.g., missing the feature dimension) could pass through to internal layers, causing cryptic runtime errors deep in the call stack. This change ensures that such errors are caught immediately at the API boundary with a clear and informative ValueError.

Fixes #190

How Has This Been Tested?

I have added a new test file tests/test_input_validation.py which contains unit tests for each of the modified models.

To reproduce/verify:

  1. Run pytest tests/test_input_validation.py

The tests verify that:

  • Passing an input tensor with shape [batch, nodes] (2D) raises a ValueError with the expected message.

  • Passing an input tensor with shape [batch, nodes, features] (3D) does not raise a shape-related error.

  • Yes

If your changes affect data processing, have you plotted any changes? i.e. have you done a quick sanity check?

  • Yes (N/A - this is a validation fix, not a data processing change)

Checklist:

  • My code follows OCF's coding style guidelines
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation (N/A - internal validation logic)
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked my code and corrected any misspellings

Koolvansh07 and others added 4 commits January 4, 2026 02:18
This commit adds explicit validation to ensure input tensors have the expected 3D shape [batch, nodes, features] in GraphWeatherForecaster, GraphWeatherAssimilator, and AuroraModel. Corresponding unit tests are added to verify the validation logic.
@Koolvansh07 Koolvansh07 force-pushed the input-validation-fix branch from 7dd39d6 to 5135ed7 Compare January 3, 2026 21:08
@Koolvansh07 Koolvansh07 closed this Jan 3, 2026
@Koolvansh07 Koolvansh07 deleted the input-validation-fix branch January 3, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add explicit input validation and clearer error messages for model inputs

1 participant