This machine learning library using Tensor-Array library
This project is still in alpha version, we are trying to make this look like the main framework but it is easier to code.
Before install this library please install NVIDIA CUDA toolkit first.
It can not work without NVIDIA CUDA toolkit.
If you did not install Python then install Python 3:
apt-get update
apt-get install python3
After that go to command and install:
pip install TensorArray
Testing with the Tensor object.
The Tensor
class is a storage that store value and calculate the tensor.
The Tensor.calc_grad()
method can do automatic differentiation.
The Tensor.get_grad()
method can get the gradient after call Tensor.calc_grad()
.
import tensor_array.core as ta
import numpy as np
def test_add():
example_tensor_array = ta.Tensor(np.array([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]], dtype=np.int32))
example_tensor_array_scalar = ta.Tensor(100)
example_tensor_sum = example_tensor_array + example_tensor_array_scalar
print(example_tensor_sum)
example_tensor_sum.calc_grad()
print(example_tensor_array.get_grad())
print(example_tensor_array_scalar.get_grad())
test_add()