Skip to content
/ thpp Public
forked from facebookarchive/thpp

TH++, C++ interface to the torch7 TH library

License

Notifications You must be signed in to change notification settings

soumith/thpp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TH++: A C++ tensor library

TH++ is a C++ tensor library, implemented as a wrapper around the TH library (the low-level tensor library in Torch). There is unfortunately little documentation about TH, but the interface mimics the Lua Tensor interface.

The core of the library is the Tensor<T> class template, where T is a numeric type (usually floating point, float or double). A tensor is a multi-dimensional array, usually in C (row-major) order, but many operations (transpose, slice, etc) are performed by permuting indexes and changing offsets, so the data is no longer contiguous / in row-major order. Read the numpy.ndarray documentation for more details about the strided indexing scheme.

Tensors may also share memory with other tensors; operations that manipulate metadata (select, slice, transpose, etc) will make the destination tensor share memory with the source. To ensure you have a unique copy, call force(Tensor<T>::UNIQUE) on the tensor. Similarly, to ensure you have a contiguous C (row-major) tensor, call force(Tensor<T>::CONTIGUOUS), which may also create a unique copy.

Please see the header file <thpp/Tensor.h> for more details.

About

TH++, C++ interface to the torch7 TH library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 98.0%
  • Shell 1.1%
  • Thrift 0.9%