ShapeContractExtensions

Helpers & Utilities · AiDotNet.Interfaces

Uniform access to the optional contract forms, whichever of them a contract actually implements.

How It Works

These were default interface methods until this assembly’s net471 target rejected them (CS8701 - the .NET Framework runtime has no such concept). Extension methods give the same “every contract answers, only the ones that care override” behaviour on EVERY target framework, and they keep the fallbacks in exactly one place rather than duplicating them at each call site.

Methods

Method Summary
IReadOnlyList<IReadOnlyList<OutputAxisContract>> OutputsFor(IShapeContract contract, IReadOnlyList<int> inputRanks) Multi-output form, falling back to wrapping the single-output answer.
IReadOnlyList<OutputAxisContract> OutputAxesFor(IShapeContract contract, int inputRank, bool isBatched) Batch-aware form, falling back to the rank-only form.
IReadOnlyList<OutputAxisContract> OutputAxesForPorts(IShapeContract contract, IReadOnlyList<int> inputRanks) Multi-port form, falling back to the single-input form when exactly one port is fed.