An open API service indexing awesome lists of open source software.

https://github.com/davidbrochart/uarray


https://github.com/davidbrochart/uarray

Last synced: 12 months ago
JSON representation

Awesome Lists containing this project

README

          

# uarray

```python
from uarray import *

x1 = uarray([0, 1, 2], 'cpu')
x2 = uarray([3, 4, 5], 'gpu')
out = uarray([0, 0, 0], 'cpu')

with context('gpu'):
add(x1, x2, out)

print(f'out = {out.array}')
```

```
Switching context from cpu to gpu
Moving "x1" from cpu to gpu
Allocating memory for "out" on gpu
Adding arrays in gpu
Moving "out" from gpu to cpu
Switching context from gpu to cpu
out = [3, 5, 7]
```