public static Transformer <TIn, TOut, TTrans> AssertStatic <[IsShape] TIn, [IsShape] TOut, TTrans>( this TTrans transformer, IHostEnvironment env, Func <SchemaAssertionContext, TIn> inputDecl, Func <SchemaAssertionContext, TOut> outputDecl) where TTrans : class, ITransformer { Contracts.CheckValue(env, nameof(env)); env.CheckValue(transformer, nameof(transformer)); env.CheckValue(inputDecl, nameof(inputDecl)); env.CheckValue(outputDecl, nameof(outputDecl)); var inSchema = StaticSchemaShape.Make <TIn>(inputDecl.Method.ReturnParameter); var outSchema = StaticSchemaShape.Make <TOut>(outputDecl.Method.ReturnParameter); return(new Transformer <TIn, TOut, TTrans>(env, transformer, inSchema, outSchema)); }
internal Estimator(IHostEnvironment env, IEstimator <TTransformer> estimator, StaticSchemaShape inShape, StaticSchemaShape outShape) : base(env, outShape) { Env.CheckValue(estimator, nameof(estimator)); AsDynamic = estimator; _inShape = inShape; // Our ability to check estimators at constructor time is somewaht limited. During fit though we could. // Fortunately, estimators are one of the least likely things that users will freqeuently declare the // types of on their own. }
internal Transformer(IHostEnvironment env, TTransformer transformer, StaticSchemaShape inShape, StaticSchemaShape outShape) : base(env, outShape) { Env.AssertValue(transformer); Env.AssertValue(inShape); AsDynamic = transformer; _inShape = inShape; // The ability to check at runtime is limited. We could check during transformation time on the input data view. }
internal DataReaderEstimator(IHostEnvironment env, IDataReaderEstimator <TIn, TDataReader> estimator, StaticSchemaShape shape) : base(env, shape) { Env.AssertValue(estimator); AsDynamic = estimator; Shape.Check(Env, AsDynamic.GetOutputSchema()); }