Skip to content
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

运算符的泛型定义,泛型方法特化 .net 9 有望解决么? #6

Open
sgf opened this issue Jul 30, 2024 · 0 comments
Open

运算符的泛型定义,泛型方法特化 .net 9 有望解决么? #6

sgf opened this issue Jul 30, 2024 · 0 comments

Comments

@sgf
Copy link

sgf commented Jul 30, 2024

虽然Tensor.NET在某些方面有优点,但不可否认其有一些明显的缺点,最主要的缺点就是基础运算符,因为.NET6和C# 10目前不支持运算符的泛型定义,也不支持针对运算符进行扩展方法那样的泛型方法特化,所以无法对加减乘除以及取模这几个基础运算符支持所有类型张量之间的操作。

当前只能在同类型张量之间使用这些基础运算符,或者使用Add, Div等函数接口来进行不同类型张量之间的运算,这可能会带来一些不方便。

这一点有望在.NET7正式发布后得到解决,利用其新特性对该问题进行优化。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant