-
Notifications
You must be signed in to change notification settings - Fork 517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CoreML] Add Xcode 9 Beta 1 bindings #2275
Conversation
Build failure |
1 similar comment
Build failure |
[Watch (4,0), TV (11,0), Mac (10,13, onlyOn64: true), iOS (11,0)] | ||
[BaseType (typeof (NSObject))] | ||
interface MLDictionaryFeatureProvider : MLFeatureProvider { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace. Same applies to the rest of the new interfaces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I always leave a Whitespace between the interface line definition and the first member definition and this is the first time I've been called out :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a single empty line is fine to delimit code and help readability
whitespace changes are specially bad when updating files since they make larger diffs and contaminate git history/blame
src/coreml.cs
Outdated
bool Optional { [Bind ("isOptional")] get; } | ||
|
||
[Export ("isAllowedValue:")] | ||
bool IsAllowedValue (MLFeatureValue value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this just be IsAllowed? Not as clearcut as some other cases.
src/coreml.cs
Outdated
|
||
[Static] | ||
[Export ("undefinedFeatureValueWithType:")] | ||
MLFeatureValue GetUndefinedFeatureValue (MLFeatureType type); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Get' sounds wrong since this is still creating and returning an MLFeatureValue same as the other static methods. FromType doesn't work since it doesn't tell you that it's an UndefinedFeatureValue, but maybe just UndefinedFeatureValueFromType? or even CreateUndefinedFeatureValue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmm I can't just use UndefinedFeatureValueFromType
since it needs to start with a verb, but yeah CreateUndefinedFeatureValue
sounds about right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'll just go CreateUndefined
since FeatureValue
is already on the type name you are creating
[Export ("dataType")] | ||
MLMultiArrayDataType DataType { get; } | ||
|
||
[Export ("shape")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could/should this use BindAs (does BindAs support NSNumber arrays)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, docs are not clear on the type we should use here nor is swift
var shape: [NSNumber]
[Export ("shape")] | ||
NSNumber [] Shape { get; } | ||
|
||
[Export ("strides")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, docs are not clear on the type we should use here nor is swift
var strides: [NSNumber]
Build failure |
@timrisi Done :) |
[Watch (4,0), TV (11,0), Mac (10,13, onlyOn64: true), iOS (11,0)] | ||
[BaseType (typeof (NSObject))] | ||
interface MLDictionaryFeatureProvider : MLFeatureProvider { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a single empty line is fine to delimit code and help readability
whitespace changes are specially bad when updating files since they make larger diffs and contaminate git history/blame
src/coreml.cs
Outdated
|
||
[Export ("objectForKeyedSubscript:")] | ||
[return: NullAllowed] | ||
MLFeatureValue ObjectForKeyedSubscript (string featureName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's already exposed by this [string]
right ?
I don't mind having a method (easier to discover) but it should be named like one ;-) as this one lack a verb/action
e.g. GetValue (string)
The alternative is to mark it as [Internal]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That might be identical to GetFeatureValue
from the protocol.
If that's the case (test needed) then it should be named identically (in fact it should not be bound as the generator will include it).
|
||
[Static] | ||
[Export ("undefinedFeatureValueWithType:")] | ||
MLFeatureValue CreateUndefined (MLFeatureType type); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason not the name it FromUndefined
to match other static methods ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Br my reading, It's creating an undefined feature value from a feature type. Normally it'd just be "fromThpe", but needs something to indicate the "undefined" part
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@spouliot What @timrisi said, just extending a little
The selector name is undefinedFeatureValueWithType:
which from my reading states that you will get an undefined feature from the given type so FromUndefined
from my reading says that what is undefined is the type parameter, not the object I am getting back that is why I think CreateUndefined
matches a little better the intent of the above selector (give me an undefined object with the following type).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sense but let's double check if Apple documentation is available (and match).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From docs:
Declares a value as undefined.
From Headers:
Represent an undefined value of a specified type
@spouliot should I change it? I think the later makes sense with CreateUndefined
. Naming is hard heh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right :) Create
makes more sense, it's the output (not in input) that's undefined.
src/coreml.cs
Outdated
MLFeatureValue FromDictionary (NSDictionary<NSObject, NSNumber> value, out NSError error); | ||
|
||
[Export ("isEqualToFeatureValue:")] | ||
bool IsEqualTo (MLFeatureValue value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
double check but IIRC we tend to use IsEqual
in recent/newer bindings
Build failure |
@spouliot fixed! thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
few more things to check ::)
src/coreml.cs
Outdated
} | ||
|
||
[Watch (4,0), TV (11,0), Mac (10,13, onlyOn64: true), iOS (11,0)] | ||
[Static] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason for not adding [Internal]
on them ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think they are more discoverable than the indexers but if you want them internal I'll follow suite :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are they used somewhere else than the strong dictionary ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh sorry wrong thread haha, yeah these need to be internal my bad :D
src/coreml.cs
Outdated
// From MLMultiArray (NSNumberDataAccess) Category | ||
|
||
[Export ("objectAtIndexedSubscript:")] | ||
NSNumber GetObjectAtIndexedSubscript (nint idx); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetObject
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It this a duplicate of either Shape[]
or Strides[]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest, I cannot determine it from the documentation
src/coreml.cs
Outdated
NSNumber GetObjectAtIndexedSubscript (nint idx); | ||
|
||
[Export ("objectForKeyedSubscript:")] | ||
NSNumber GetObjectForKeyedSubscript (NSNumber [] key); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
@spouliot done :) |
Build failure |
Build failure |
Build failure |
unrelated failure
@timrisi Are you ok with merging this? Is there anything pending? |
No description provided.