Skip to content

fix(build): add the base hooks the #1789 split slices override - #1991

Merged
ooples merged 1 commit into
masterfrom
fix/base-hooks-for-1789-slices
Aug 8, 2026
Merged

ooples merged 1 commit into
masterfrom
fix/base-hooks-for-1789-slices

Conversation

@ooples

@ooples ooples commented Aug 8, 2026

Copy link
Copy Markdown
Owner

What

Adds the two base-class members that every #1789 split slice overrides but that only ever existed on the #1789 branch itself:

Member Where Why the slices need it
LayerBase<T>.ForwardTraced(Tensor<T>) src/NeuralNetworks/Layers/LayerBase.cs ~16 layers across the TimeSeries slices declare protected override Tensor<T> ForwardTraced(...)
FinancialModelBase<T>.TrainingOptimizer src/Finance/Base/FinancialModelBase.cs FactorVAE<T> and siblings declare protected override ... TrainingOptimizer

Plus src/NeuralNetworks/Graph/LayerForwardObserver.cs, which Forward now consults.

Why standalone

This is the shared failure. Slices #1967–#1983 each target master independently, so every one of them hits the same CS0115: no suitable method found to override until #1789 lands in full. Landing just the base declarations unblocks all of them at once, in any merge order.

The Forward change

LayerBase<T>.Forward goes from abstract to virtual. It now delegates to ForwardTraced and records the call when an observer is attached — the same __call__/forward split PyTorch uses, so the framework has one place to stand between the caller and the computation. Existing layers that override Forward are unaffected; they keep working and are simply invisible to tracing.

ForwardTraced's default throws NotSupportedException rather than NotImplementedException: a layer overriding neither has no computation at all, and is not going to acquire one later.

Verification

dotnet build src/AiDotNet.csproj -f net8.0   -> 0 Error(s)
dotnet build src/AiDotNet.csproj -f net471   -> 0 Error(s)

🤖 Generated with Claude Code

Every split slice of #1789 fails to compile against master with CS0115, and always
on the same two members. The slices carry the overrides; the base declarations
were only ever on the #1789 branch itself, so no slice can build until that whole
PR lands. Both are added here so the slices compile against master in any order.

LayerBase.Forward stops being abstract. It becomes the single point every forward
call passes through, delegating to a new protected virtual ForwardTraced, and
recording the call when a LayerForwardObserver is attached. That is what makes a
model's real dataflow recoverable from one forward pass instead of from a declared
topology that can drift. Layers that still override Forward keep working and are
simply invisible to tracing.

ForwardTraced's default throws NotSupportedException, not NotImplementedException:
a layer that overrides neither has no computation at all, and will not acquire one
later.

FinancialModelBase gains a virtual TrainingOptimizer, and the shared tape path
passes it to TrainWithTape. A model that built its own optimizer from its options
previously had no way to hand it over, so the framework default silently won.

Verified: net8.0 and net471 both build with 0 errors.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 8, 2026 13:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@vercel

vercel Bot commented Aug 8, 2026

Copy link
Copy Markdown

Deployment failed for project aidotnet-playground-api with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/franklins-projects-02a0b5a0?upgradeToPro=build-rate-limit

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@ooples, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 5 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: aa593501-0ae0-40b4-8378-298f90c772bd

📥 Commits

Reviewing files that changed from the base of the PR and between 449e778 and e118f7a.

📒 Files selected for processing (3)
  • src/Finance/Base/FinancialModelBase.cs
  • src/NeuralNetworks/Graph/LayerForwardObserver.cs
  • src/NeuralNetworks/Layers/LayerBase.cs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ooples

ooples commented Aug 8, 2026

Copy link
Copy Markdown
Owner Author

Measured on origin/split/1789-17-finance-timeseries (PR #1982), which is representative of the split slices — merged this branch into it and rebuilt src/AiDotNet.csproj -f net8.0:

errors breakdown
before 92 32 × CS0115, 30 × CS0534, 30 × CS0246
after 30 30 × CS0246

Every CS0115 (no suitable method found to override) and every CS0534 (does not implement inherited abstract member Forward) is gone. The 30 CS0246 that remain are the slice's own dependency on the option types in #1968 — a per-slice ordering issue, not a shared one.

@ooples
ooples merged commit bfd91b6 into master Aug 8, 2026
11 of 98 checks passed
@ooples
ooples deleted the fix/base-hooks-for-1789-slices branch August 8, 2026 14:17
ooples pushed a commit that referenced this pull request Aug 9, 2026
Both conflicts are this branch meeting its own extract. #1991 lifted the two base
hooks out of here so the split slices could build against master, master then
reviewed them, and the review changed things this branch never saw.

LayerBase.Forward/ForwardTraced: took master's copy, which throws
NotSupportedException rather than NotImplementedException -- the type does not
support the call and never will without an override, where
NotImplementedException promises an implementation that is not coming. Kept this
branch's MIGRATION paragraph instead of master's: it names ADNSHAPE004 as the
thing that counts the un-migrated layers, and that diagnostic exists here and
not on master, so master's wording is the one that goes stale after the merge.

FinancialModelBase.TrainingOptimizer: identical member, master's doc. It records
why the hook exists -- a model that builds its own optimizer from its options had
no way to hand it to the shared TrainWithTape path, so the framework default
silently won -- which is the part worth keeping.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ooples added a commit that referenced this pull request Aug 12, 2026
Every split slice of #1789 fails to compile against master with CS0115, and always
on the same two members. The slices carry the overrides; the base declarations
were only ever on the #1789 branch itself, so no slice can build until that whole
PR lands. Both are added here so the slices compile against master in any order.

LayerBase.Forward stops being abstract. It becomes the single point every forward
call passes through, delegating to a new protected virtual ForwardTraced, and
recording the call when a LayerForwardObserver is attached. That is what makes a
model's real dataflow recoverable from one forward pass instead of from a declared
topology that can drift. Layers that still override Forward keep working and are
simply invisible to tracing.

ForwardTraced's default throws NotSupportedException, not NotImplementedException:
a layer that overrides neither has no computation at all, and will not acquire one
later.

FinancialModelBase gains a virtual TrainingOptimizer, and the shared tape path
passes it to TrainWithTape. A model that built its own optimizer from its options
previously had no way to hand it over, so the framework default silently won.

Verified: net8.0 and net471 both build with 0 errors.

Co-authored-by: t <t@e.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
ooples pushed a commit that referenced this pull request Aug 12, 2026
Both conflicts are this branch meeting its own extract. #1991 lifted the two base
hooks out of here so the split slices could build against master, master then
reviewed them, and the review changed things this branch never saw.

LayerBase.Forward/ForwardTraced: took master's copy, which throws
NotSupportedException rather than NotImplementedException -- the type does not
support the call and never will without an override, where
NotImplementedException promises an implementation that is not coming. Kept this
branch's MIGRATION paragraph instead of master's: it names ADNSHAPE004 as the
thing that counts the un-migrated layers, and that diagnostic exists here and
not on master, so master's wording is the one that goes stale after the merge.

FinancialModelBase.TrainingOptimizer: identical member, master's doc. It records
why the hook exists -- a model that builds its own optimizer from its options had
no way to hand it to the shared TrainWithTape path, so the framework default
silently won -- which is the part worth keeping.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

2 participants