MXNetSharp icon indicating copy to clipboard operation
MXNetSharp copied to clipboard

Pow operator inference problems

Open kevmal opened this issue 5 years ago • 0 comments

let nd = CPU(0).CopyFrom([|0.0 .. 10.0|])
let a = 2.0 + (2.0 ** nd)
let b = (2.0 ** nd) + 2.0

Both a and b fail overload resolution

error FS0071: Type constraint mismatch when applying the default type 'obj' for a type inference variable. No overloads match for method 'op_DynamicAssignment'. The available overloads are shown below. Consider adding further type constraints
Possible overload: 'static member InternalPrimitiveOperatorHelpers.PowerOp.( ?<- ) : PowerOp:InternalPrimitiveOperatorHelpers.PowerOp * Dummy1:InternalPrimitiveOperatorHelpers.Dummy1 * a: ^a0 -> ( ^a1 ->  ^a0) when  ^a0 : (static member Pow :  ^a0 *  ^a1 ->  ^a0)'. Type constraint mismatch. The type 
    'obj'    
is not compatible with type
    'InternalPrimitiveOperatorHelpers.Dummy1'    
.
Possible overload: 'static member InternalPrimitiveOperatorHelpers.PowerOp.( ?<- ) : PowerOp:InternalPrimitiveOperatorHelpers.PowerOp * Dummy2:InternalPrimitiveOperatorHelpers.Dummy2 * a: ^t -> ( ^y ->  ^s) when ( ^t or  ^y) : (static member ApplyPow :  ^t *  ^y ->  ^s)'. Type constraint mismatch. The type 
    'obj'    
is not compatible with type
    'InternalPrimitiveOperatorHelpers.Dummy2'    

Best solution define a new operator and not use (**)

kevmal avatar Jan 08 '20 16:01 kevmal