Paddle paddle.linalg.expm API

uinbv5nw  于 2022-10-23  发布在  其他
关注(0)|答案(5)|浏览(172)

请问paddle 预期什么时候实现 paddle.linalg.expm 这个api
等同于
scipy.linalg.expm
以及:
torch.matrix_exp
https://pytorch.org/docs/stable/generated/torch.matrix_exp.html

e的矩阵次方

或者动态图开放类似于 torch.autograd.Function 的功能,可以自己python定义op,不用写c再编译。

slsn1g29

slsn1g291#

您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看 官网API文档常见问题历史IssueAI社区 来寻求解答。祝您生活愉快~

Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the APIFAQGithub Issue and AI community to get the answer.Have a nice day!

hec6srdp

hec6srdp2#

您好,您的反馈对产品非常有价值,我们内部会安排评估,未来有计划尽快回复。目前Paddle2.1及以上的动态图支持 paddle.autograd.PyLayer 你参考https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/autograd/PyLayer_cn.html#paddle.autograd.PyLayer 看下是否能实现 torch.autograd.Function 的功能。

kmynzznz

kmynzznz3#

可以试下 paddle.linalg.matrix_power 文档: https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/linalg/matrix_power_cn.html
示例:

torch

x = torch.matrix_exp(torch.tensor([[2,0],[0,2]],dtype=torch.float))
x
tensor([[7.3891, 0.0000],
[0.0000, 7.3891]])

paddle

x = paddle.linalg.matrix_power(math.exp(1)*paddle.to_tensor([[1.,0],[0,1.]],dtype='float64'),n=2)
x
Tensor(shape=[2, 2], dtype=float64, place=CUDAPlace(0), stop_gradient=True,
[[7.38905565, 0. ],
[0. , 7.38905565]])

bybem2ql

bybem2ql4#

@firestonelib
谢谢您的回答,用matrix power这个方法 对于对角或者可以对角化的矩阵应该可以的,但是对于一般的矩阵不行。
Pytorch 用了 "Bader, P.; Blanes, S.; Casas, F. Computing the Matrix Exponential with an Optimized Taylor Polynomial Approximation. Mathematics 2019, 7, 1174." 这个论文的算法。

这个应该是目前SOTA的matrix exponential的算法。

如果您有开发这个API的计划,我们可以更进一步进行一下细节上的交流。

@firestonelib
Thank you. The matrix power api you mentioned is suitable in the case when the matrix is diagonal or diagnizable. But, it is not the solution for general cases.

In general,

That is why torch implement the algorithm in the paper "Bader, P.; Blanes, S.; Casas, F. Computing the Matrix Exponential with an Optimized Taylor Polynomial Approximation. Mathematics 2019, 7, 1174."

Although there is a lot of algorithms to calcuate matrix exponential, it's seems like the Bader's paper is the state-of-the-art solution.

If you have a plan for this API, we can have a further discussion about the implemetaion details.

tkclm6bt

tkclm6bt5#

You are very welcome to submit implementation of this API to us. You can refer to the requirements of the new API(such as rfc, code and docs) in our current Hackathon, and we can arrange experts to review and discuss.

相关问题