Skip to content

F# 6.0 -> 7.0: A unique overload for method could not be determined #14302

Closed
@pkese

Description

@pkese

Please provide a succinct description of the issue.

I had the following TorchSharp code working fine in F# 6.0:

let xs = torch.zeros([|10L|], dtype=torch.float32)

After upgrading to F# 7.0 the compiler started complaining:

*A unique overload for method 'zeros' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: int64 array * dtype: torch.ScalarType * device: torch.Device * requiresGrad: bool

Candidates:
- torch.zeros(size: ReadOnlySpan<int64>, ?dtype: Nullable<torch.ScalarType>, ?device: torch.Device, ?requiresGrad: bool) : torch.Tensor 
- torch.zeros(size: ReadOnlySpan<int64>, ?dtype: Nullable<torch.ScalarType>, ?device: torch.Device, ?requiresGrad: bool) : torch.Tensor 
- torch.zeros(size: int64 array, ?dtype: Nullable<torch.ScalarType>, ?device: torch.Device, ?requiresGrad: bool) : torch.Tensor*

It does work in F# 7.0 if I change the code to:

let xs = torch.zeros([|10L|], ?dtype=Some torch.float32)

... but having to sprinkle this all over the code (in this way) is clumsy and hinders readability.

Yes, there's a workaround,
but from a usability perspective, I'd call this a regression.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingBugImpact-High(Internal MS Team use only) Describes an issue with extreme impact on existing code.Regression

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions