Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A C++ machine learning framework/library.

License

NotificationsYou must be signed in to change notification settings

Tensor-Array/Tensor-Array

Repository files navigation

C++Docker Image Size with architecture (latest by date/latest semver)

A C++ Tensor library that can be used to work with machine learning or deep learning project.

Build your own neural network models with this library.

InstallingTensor-Array

You need to clone repository by usingGit

You need to installTensor-Array withCMake

git clone https://github.com/Tensor-Array/Tensor-Array.gitcd Tensor-Arraymkdir buildcd buildcmake ..cmake --build.cmake --install.cd ..

Why this repository namedTensor-Array

We created a template struct that namedTensorArray. That struct is a multi-dimensional array wrapper.

#include<tensor-array/core/tensorbase.hh>usingnamespacetensor_array::value;intmain(){  TensorArray<float,4,4> example_tensor_array =  {{    {{1,2,3,4 }},    {{5,6,7,8 }},    {{9,10,11,12 }},    {{13,14,15,16 }},  }};return0;}

That code is wrapping for:

intmain(){float example_tensor_array[4][4] =  {    {1,2,3,4 },    {5,6,7,8 },    {9,10,11,12 },    {13,14,15,16 },  };return0;}

TheTensor class.

TheTensor class is a storage that store value and calculate the tensor.

TheTensor::calc_grad() method can do automatic differentiation.

TheTensor::get_grad() method can get the gradient after callTensor::calc_grad().

#include<iostream>#include<tensor-array/core/tensor.hh>usingnamespacestd;usingnamespacetensor_array::value;intmain(){  TensorArray<float,4,4> example_tensor_array =  {{    {{1,2,3,4 }},    {{5,6,7,8 }},    {{9,10,11,12 }},    {{13,14,15,16 }},  }};  TensorArray<float> example_tensor_array_scalar = {100};  Tensorexample_tensor_1(example_tensor_array);  Tensorexample_tensor_2(example_tensor_array_scalar);  Tensor example_tensor_sum = example_tensor_1 + example_tensor_2;  cout << example_tensor_sum << endl;  example_tensor_sum.calc_grad();  cout << example_tensor_1.get_grad() << endl;  cout << example_tensor_2.get_grad() << endl;return0;}

[8]ページ先頭

©2009-2025 Movatter.jp