# Torch Vectorized
> Batched and vectorized operations on volume of 3x3 symmetric matrices with Pytorch. The current Pytorch's implementation of batch eigen-decomposition is very slow when dealing with huge number of small matrices (e.g. 500k x 3x3). **This library offers some basic functions like vSymEig, vExpm and vLogm for fast computation (>250x faster) of huge number of small matrices with Pytorch using an analytical solution.**
#### Read the documentaton [HERE](https://torch-vectorized.readthedocs.io/en/latest/)
## vSymEig
> A quick closed-form solution for volumetric 3x3 matrices Eigen-Decomposition with Pytorch. Solves Eigen-Decomposition of data with shape Bx9xDxHxW, where B is the batch size, 9 is the flattened 3x3 symmetric matrices, D is the depth, H is the Height, W is the width. The goal is to accelerate the Eigen-Decomposition of multiple (>500k) small matrices (3x3) on GPU with Pytorch using an analytical solution.
<img src="https://raw.githubusercontent.com/banctilrobitaille/torch-vectorized/master/icons/vsymeig.png" width="100%" vertical-align="bottom">
## vExpm
> Based on vSymEig, computes the matrix exponential for batch of volumetric 3x3 matrices.
<img src="https://raw.githubusercontent.com/banctilrobitaille/torch-vectorized/master/icons/vexpm.png" width="100%" vertical-align="bottom">
## vLogm
> Based on vSymEig, computes the matrix logarithm for batch of volumetric 3x3 matrices.
<img src="https://raw.githubusercontent.com/banctilrobitaille/torch-vectorized/master/icons/vlogm.png" width="100%" vertical-align="bottom">
## Install me
> pip install torch-vectorized
## How to use
```python
from torchvectorized.vlinalg import vSymeig
# Random batch of volumetric 3x3 symmetric matrices of size 16x9x32x32x32
input = sym(torch.rand(16, 9, 32, 32, 32))
# Output eig_vals with size: 16x3x32x32x32 and eig_vecs with size 16,3,3,32,32,32
eig_vals, eig_vecs = vSymeig(input, eigen_vectors=True)
def sym(self, inputs):
# Ensure symmetry of randomly generated 3x3 matrix using (X + X.T) / 2.0
return (inputs + inputs[:, [0, 3, 6, 1, 4, 7, 2, 5, 8], :, :, :]) / 2.0
```
## Contributing
#### How to contribute ?
- [X] Create a branch by feature and/or bug fix
- [X] Get the code
- [X] Commit and push
- [X] Create a pull request
#### Branch naming
##### Feature branch
> feature/ [Short feature description] [Issue number]
##### Bug branch
> fix/ [Short fix description] [Issue number]
#### Commits syntax:
##### Adding code:
> \+ Added [Short Description] [Issue Number]
##### Deleting code:
> \- Deleted [Short Description] [Issue Number]
##### Modifying code:
> \* Changed [Short Description] [Issue Number]
##### Merging code:
> Y Merged [Short Description] [Issue Number]
Icons made by <a href="http://www.flaticon.com/authors/freepik" title="Freepik">Freepik</a> from <a href="http://www.flaticon.com" title="Flaticon">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a>
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
资源分类:Python库 所属语言:Python 资源全名:torch-vectorized-0.1.10.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源推荐
资源详情
资源评论
收起资源包目录
torch-vectorized-0.1.10.tar.gz (12个子文件)
torch-vectorized-0.1.10
PKG-INFO 4KB
torchvectorized
vlinalg.py 10KB
nn.py 9KB
__init__.py 0B
setup.cfg 42B
torch_vectorized.egg-info
PKG-INFO 4KB
requires.txt 44B
SOURCES.txt 294B
top_level.txt 16B
dependency_links.txt 1B
setup.py 901B
README.md 3KB
共 12 条
- 1
资源评论
挣扎的蓝藻
- 粉丝: 14w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功