diff --git a/src/coreml.cs b/src/coreml.cs index 2ab2272f03ce..cc4c862bd1e2 100644 --- a/src/coreml.cs +++ b/src/coreml.cs @@ -29,7 +29,7 @@ public enum MLFeatureType : nint { String = 3, Image = 4, MultiArray = 5, - Dictionary = 6 + Dictionary = 6, } [Watch (4,0), TV (11,0), Mac (10,13, onlyOn64: true), iOS (11,0)] @@ -38,8 +38,7 @@ public enum MLFeatureType : nint { public enum MLModelError : nint { Generic = 0, FeatureType = 1, - DescriptionMismatch = 2, - Io = 3 + IO = 3, } [Watch (4,0), TV (11,0), Mac (10,13, onlyOn64: true), iOS (11,0)] @@ -47,7 +46,7 @@ public enum MLModelError : nint { public enum MLMultiArrayDataType : nint { Double = 65536 | 64, Float32 = 65536 | 32, - Int32 = 131072 | 32 + Int32 = 131072 | 32, } [Watch (4,0), TV (11,0), Mac (10,13, onlyOn64: true), iOS (11,0)] @@ -76,6 +75,22 @@ interface MLFeatureDescription : NSCopying { [Export ("isAllowedValue:")] bool IsAllowed (MLFeatureValue value); + + // Category MLFeatureDescription (MLFeatureValueConstraints) + + // HACK: radar://33643011 -> https://trello.com/c/ZN712GOi + + // [FAIL] Selector not found for CoreML.MLFeatureDescription : setMultiArrayConstraint: + [NullAllowed, Export ("multiArrayConstraint", ArgumentSemantic.Assign)] + MLMultiArrayConstraint MultiArrayConstraint { get; /*set;*/ } + + // [FAIL] Selector not found for CoreML.MLFeatureDescription : setImageConstraint: + [NullAllowed, Export ("imageConstraint", ArgumentSemantic.Assign)] + MLImageConstraint ImageConstraint { get; /*set;*/ } + + // [FAIL] Selector not found for CoreML.MLFeatureDescription : setDictionaryConstraint: + [NullAllowed, Export ("dictionaryConstraint", ArgumentSemantic.Assign)] + MLDictionaryConstraint DictionaryConstraint { get; /*set;*/ } } interface IMLFeatureProvider { } @@ -166,11 +181,22 @@ interface MLModel { [Static] [Export ("modelWithContentsOfURL:error:")] [return: NullAllowed] - MLModel FromUrl (NSUrl url, [NullAllowed] out NSError error); + MLModel FromUrl (NSUrl url, out NSError error); [Export ("predictionFromFeatures:error:")] [return: NullAllowed] IMLFeatureProvider GetPrediction (IMLFeatureProvider input, out NSError error); + + [Export ("predictionFromFeatures:options:error:")] + [return: NullAllowed] + IMLFeatureProvider GetPrediction (IMLFeatureProvider input, MLPredictionOptions options, out NSError error); + + // Category MLModel (MLModelCompilation) + + [Static] + [Export ("compileModelAtURL:error:")] + [return: NullAllowed] + NSUrl CompileModel (NSUrl modelUrl, out NSError error); } [Watch (4,0), TV (11,0), Mac (10,13, onlyOn64: true), iOS (11,0)] @@ -266,5 +292,49 @@ interface MLMultiArray { [Export ("setObject:forKeyedSubscript:")] void SetObject (NSNumber obj, NSNumber [] key); } + + [Watch (4,0), TV (11,0), Mac (10,13, onlyOn64: true), iOS (11,0)] + [DisableDefaultCtor] + [BaseType (typeof (NSObject))] + interface MLDictionaryConstraint { + + [Export ("keyType")] + MLFeatureType KeyType { get; } + } + + [Watch (4,0), TV (11,0), Mac (10,13, onlyOn64: true), iOS (11,0)] + [DisableDefaultCtor] + [BaseType (typeof (NSObject))] + interface MLImageConstraint { + + [Export ("pixelsHigh")] + nint PixelsHigh { get; } + + [Export ("pixelsWide")] + nint PixelsWide { get; } + + [Export ("pixelFormatType")] + uint PixelFormatType { get; } + } + + [Watch (4,0), TV (11,0), Mac (10,13, onlyOn64: true), iOS (11,0)] + [DisableDefaultCtor] + [BaseType (typeof (NSObject))] + interface MLMultiArrayConstraint { + + [Export ("shape")] + NSNumber [] Shape { get; } + + [Export ("dataType")] + MLMultiArrayDataType DataType { get; } + } + + [Watch (4,0), TV (11,0), Mac (10,13, onlyOn64: true), iOS (11,0)] + [BaseType (typeof (NSObject))] + interface MLPredictionOptions { + + [Export ("usesCPUOnly")] + bool UsesCpuOnly { get; set; } + } } #endif // XAMCORE_2_0 diff --git a/tests/introspection/ApiProtocolTest.cs b/tests/introspection/ApiProtocolTest.cs index 5f8ae17a00cb..c18789d3f0d9 100644 --- a/tests/introspection/ApiProtocolTest.cs +++ b/tests/introspection/ApiProtocolTest.cs @@ -81,6 +81,10 @@ protected virtual bool Skip (Type type, string protocolName) case "GKCloudPlayer": // iOS 10 : test throw because of generic usage case "NSMeasurement`1": + // Xcode 9 - Conformance not in heades + case "MLDictionaryConstraint": + case "MLImageConstraint": + case "MLMultiArrayConstraint": return true; // skip } break; diff --git a/tests/xtro-sharpie/common.pending b/tests/xtro-sharpie/common.pending index a429e4757e49..b4562f889f49 100644 --- a/tests/xtro-sharpie/common.pending +++ b/tests/xtro-sharpie/common.pending @@ -653,4 +653,12 @@ # CoreML ## we do not have NSFastEnumeration and decided to not bind objectForKeyedSubscript using a local method instead !missing-protocol-conformance! MLDictionaryFeatureProvider should conform to NSFastEnumeration -!missing-selector! MLDictionaryFeatureProvider::objectForKeyedSubscript: not bound \ No newline at end of file +!missing-selector! MLDictionaryFeatureProvider::objectForKeyedSubscript: not bound + +## radar://33643011 -> https://trello.com/c/ZN712GOi +## [FAIL] Selector not found for CoreML.MLFeatureDescription : setMultiArrayConstraint: +## [FAIL] Selector not found for CoreML.MLFeatureDescription : setImageConstraint: +## [FAIL] Selector not found for CoreML.MLFeatureDescription : setDictionaryConstraint: +!missing-selector! MLFeatureDescription::setDictionaryConstraint: not bound +!missing-selector! MLFeatureDescription::setImageConstraint: not bound +!missing-selector! MLFeatureDescription::setMultiArrayConstraint: not bound