void ISaveAsOnnx.SaveAsOnnx(OnnxContext ctx) { Host.CheckValue(ctx, nameof(ctx)); Host.Assert(Bindable is IBindableCanSaveOnnx); var onnxBindable = (IBindableCanSaveOnnx)Bindable; var schema = _bindings.RowMapper.InputRoleMappedSchema; Host.Assert(_bindings.DerivedColumnCount == 0); string[] outVariableNames = new string[_bindings.InfoCount]; for (int iinfo = 0; iinfo < _bindings.InfoCount; ++iinfo) { int colIndex = _bindings.MapIinfoToCol(iinfo); string colName = _bindings.GetColumnName(colIndex); colName = ctx.AddIntermediateVariable(_bindings.GetColumnType(colIndex), colName); outVariableNames[iinfo] = colName; } if (!onnxBindable.SaveAsOnnx(ctx, schema, outVariableNames)) { foreach (var name in outVariableNames) { ctx.RemoveVariable(name, true); } } }