All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
faiss::gpu::DeviceTensor< T, Dim, InnerContig, IndexT, PtrTraits > Class Template Reference
Inheritance diagram for faiss::gpu::DeviceTensor< T, Dim, InnerContig, IndexT, PtrTraits >:

## Public Types

typedef IndexT | IndexType
typedef PtrTraits< T >::PtrType | DataPtrType
Public Types inherited from faiss::gpu::Tensor< T, Dim, InnerContig, IndexT, PtrTraits >
enum | { NumDim = Dim }
enum | { IsInnerContig = InnerContig }
typedef T | DataType
typedef IndexT | IndexType
typedef PtrTraits< T >::PtrType | DataPtrType
typedef Tensor< T, Dim, InnerContig, IndexT, PtrTraits > | TensorType

## Public Member Functions

__host__ | DeviceTensor ()
| Default constructor.
__host__ | ~DeviceTensor ()
| Destructor.
__host__ | DeviceTensor (DeviceTensor< T, Dim, InnerContig, IndexT, PtrTraits > &&t)
| Move constructor.
__host__ DeviceTensor< T, Dim, InnerContig, IndexT, PtrTraits > & | operator= (DeviceTensor< T, Dim, InnerContig, IndexT, PtrTraits > &&t)
| Move assignment.
__host__ | DeviceTensor (const IndexT sizes[Dim], MemorySpace space=MemorySpace::Device)
__host__ | DeviceTensor (std::initializer_list< IndexT > sizes, MemorySpace space=MemorySpace::Device)
__host__ | DeviceTensor (DeviceMemory &m, const IndexT sizes[Dim], cudaStream_t stream, MemorySpace space=MemorySpace::Device)
__host__ | DeviceTensor (DeviceMemory &m, std::initializer_list< IndexT > sizes, cudaStream_t stream, MemorySpace space=MemorySpace::Device)
__host__ | DeviceTensor (DataPtrType data, const IndexT sizes[Dim], MemorySpace space=MemorySpace::Device)
__host__ | DeviceTensor (DataPtrType data, std::initializer_list< IndexT > sizes, MemorySpace space=MemorySpace::Device)
__host__ | DeviceTensor (DataPtrType data, const IndexT sizes[Dim], const IndexT strides[Dim], MemorySpace space=MemorySpace::Device)
__host__ | DeviceTensor (Tensor< T, Dim, InnerContig, IndexT, PtrTraits > &t, cudaStream_t stream, MemorySpace space=MemorySpace::Device)
| Copies a tensor into ourselves, allocating memory for it locally.
__host__ | DeviceTensor (DeviceMemory &m, Tensor< T, Dim, InnerContig, IndexT, PtrTraits > &t, cudaStream_t stream, MemorySpace space=MemorySpace::Device)
__host__ DeviceTensor< T, Dim, InnerContig, IndexT, PtrTraits > & | zero (cudaStream_t stream)
| Call to zero out memory.
Public Member Functions inherited from faiss::gpu::Tensor< T, Dim, InnerContig, IndexT, PtrTraits >
__host__ __device__ | Tensor ()
| Default constructor.
__host__ __device__ | Tensor (Tensor< T, Dim, InnerContig, IndexT, PtrTraits > &t)=default
| Copy constructor.
__host__ __device__ | Tensor (Tensor< T, Dim, InnerContig, IndexT, PtrTraits > &&t)=default
| Move constructor.
__host__ __device__ Tensor< T, Dim, InnerContig, IndexT, PtrTraits > & | operator= (Tensor< T, Dim, InnerContig, IndexT, PtrTraits > &t)=default
| Assignment.
__host__ __device__ Tensor< T, Dim, InnerContig, IndexT, PtrTraits > & | operator= (Tensor< T, Dim, InnerContig, IndexT, PtrTraits > &&t)
| Move assignment.
__host__ __device__ | Tensor (DataPtrType data, const IndexT sizes[Dim])
| Constructor that calculates strides with no padding.
__host__ __device__ | Tensor (DataPtrType data, std::initializer_list< IndexT > sizes)
__host__ __device__ | Tensor (DataPtrType data, const IndexT sizes[Dim], const IndexT strides[Dim])
__host__ void | copyFrom (Tensor< T, Dim, InnerContig, IndexT, PtrTraits > &t, cudaStream_t stream)
| Copies a tensor into ourselves; sizes must match.
__host__ void | copyTo (Tensor< T, Dim, InnerContig, IndexT, PtrTraits > &t, cudaStream_t stream)
| Copies ourselves into a tensor; sizes must match.
template<typename OtherT , int OtherDim>
__host__ __device__ bool | isSame (const Tensor< OtherT, OtherDim, InnerContig, IndexT, PtrTraits > &rhs) const
template<typename OtherT , int OtherDim>
__host__ __device__ bool | isSameSize (const Tensor< OtherT, OtherDim, InnerContig, IndexT, PtrTraits > &rhs) const
| Returns true if the two tensors are of the same dimensionality and size.
template<typename U >
__host__ __device__ Tensor< U, Dim, InnerContig, IndexT, PtrTraits > | cast ()
template<typename U >
__host__ __device__ const Tensor< U, Dim, InnerContig, IndexT, PtrTraits > | cast () const
| Const version of `cast`
template<typename U >
__host__ __device__ Tensor< U, Dim, InnerContig, IndexT, PtrTraits > | castResize ()
template<typename U >
__host__ __device__ const Tensor< U, Dim, InnerContig, IndexT, PtrTraits > | castResize () const
| Const version of `castResize`
template<typename U >
__host__ __device__ bool | canCastResize () const
| Returns true if we can castResize() this tensor to the new type.
template<typename NewIndexT >
__host__ Tensor< T, Dim, InnerContig, NewIndexT, PtrTraits > | castIndexType () const
template<typename NewIndexT >
__host__ bool | canUseIndexType () const
__host__ __device__ DataPtrType | data ()
| Returns a raw pointer to the start of our data.
__host__ __device__ DataPtrType | end ()
__host__ __device__ const DataPtrType | data () const
| Returns a raw pointer to the start of our data (const).
__host__ __device__ DataPtrType | end () const
template<typename U >
__host__ __device__ PtrTraits < U >::PtrType | dataAs ()
| Cast to a different datatype.
template<typename U >
__host__ __device__ const PtrTraits< const U >::PtrType | dataAs () const
| Cast to a different datatype.
__host__ __device__ detail::SubTensor< TensorType, Dim-1, PtrTraits > | operator[] (IndexT)
| Returns a read/write view of a portion of our tensor.
__host__ __device__ const detail::SubTensor< TensorType, Dim-1, PtrTraits > | operator[] (IndexT) const
| Returns a read/write view of a portion of our tensor (const).
__host__ __device__ IndexT | getSize (int i) const
__host__ __device__ IndexT | getStride (int i) const
__host__ __device__ size_t | numElements () const
__host__ __device__ size_t | getSizeInBytes () const
__host__ __device__ const IndexT * | sizes () const
| Returns the size array.
__host__ __device__ const IndexT * | strides () const
| Returns the stride array.
__host__ __device__ bool | isContiguous () const
__host__ __device__ bool | isConsistentlySized (int i) const
__host__ __device__ bool | isConsistentlySized () const
__host__ __device__ bool | isContiguousDim (int i) const
| Returns true if the given dimension index has no padding.
__host__ __device__ Tensor< T, Dim, InnerContig, IndexT, PtrTraits > | transpose (int dim1, int dim2) const
template<int NewDim>
__host__ __device__ Tensor< T, NewDim, InnerContig, IndexT, PtrTraits > | upcastOuter ()
template<int NewDim>
__host__ __device__ Tensor< T, NewDim, InnerContig, IndexT, PtrTraits > | upcastInner ()
template<int NewDim>
__host__ __device__ Tensor< T, NewDim, InnerContig, IndexT, PtrTraits > | downcastOuter ()
template<int NewDim>
__host__ __device__ Tensor< T, NewDim, InnerContig, IndexT, PtrTraits > | downcastInner ()
template<int SubDim>
__host__ __device__ Tensor< T, SubDim, InnerContig, IndexT, PtrTraits > | view (DataPtrType at)
template<int SubDim>
__host__ __device__ Tensor< T, SubDim, InnerContig, IndexT, PtrTraits > | view ()
__host__ __device__ Tensor< T, Dim, InnerContig, IndexT, PtrTraits > | narrowOutermost (IndexT start, IndexT size)
__host__ __device__ Tensor< T, Dim, InnerContig, IndexT, PtrTraits > | narrow (int dim, IndexT start, IndexT size)
template<int NewDim>
__host__ __device__ Tensor< T, NewDim, InnerContig, IndexT, PtrTraits > | view (std::initializer_list< IndexT > sizes)

## Additional Inherited Members

Protected Attributes inherited from faiss::gpu::Tensor< T, Dim, InnerContig, IndexT, PtrTraits >
DataPtrType | data_
| Raw pointer to where the tensor data begins.
IndexT | stride_ [Dim]
| Array of strides (in sizeof(T) terms) per each dimension.
IndexT | size_ [Dim]
| Size per each dimension.

## Detailed Description

### template<typename T, int Dim, bool InnerContig = false, typename IndexT = int, template< typename U > class PtrTraits = traits::DefaultPtrTraits>
class faiss::gpu::DeviceTensor< T, Dim, InnerContig, IndexT, PtrTraits >

Definition at line 24 of file DeviceTensor.cuh.

## Constructor & Destructor Documentation

template<typename T, int Dim, bool InnerContig, typename IndexT, template< typename U > class PtrTraits>

__host__ faiss::gpu::DeviceTensor< T, Dim, InnerContig, IndexT, PtrTraits >::DeviceTensor | ( | const IndexT | sizes[Dim],
|  | MemorySpace | space = `MemorySpace::Device`
| ) |  |

Constructs a tensor of the given size, allocating memory for it locally

Definition at line 72 of file DeviceTensor-inl.cuh.

template<typename T, int Dim, bool InnerContig, typename IndexT, template< typename U > class PtrTraits>

__host__ faiss::gpu::DeviceTensor< T, Dim, InnerContig, IndexT, PtrTraits >::DeviceTensor | ( | DeviceMemory & | m,
|  | const IndexT | sizes[Dim],
|  | cudaStream_t | stream,
|  | MemorySpace | space = `MemorySpace::Device`
| ) |  |

Constructs a tensor of the given size, reserving a temporary memory reservation via a memory manager. The memory reservation should be ordered with respect to the given stream.

Definition at line 101 of file DeviceTensor-inl.cuh.

template<typename T, int Dim, bool InnerContig, typename IndexT, template< typename U > class PtrTraits>

__host__ faiss::gpu::DeviceTensor< T, Dim, InnerContig, IndexT, PtrTraits >::DeviceTensor | ( | DataPtrType | data,
|  | const IndexT | sizes[Dim],
|  | MemorySpace | space = `MemorySpace::Device`
| ) |  |

Constructs a tensor of the given size and stride, referencing a memory region we do not own

Definition at line 142 of file DeviceTensor-inl.cuh.

template<typename T, int Dim, bool InnerContig, typename IndexT, template< typename U > class PtrTraits>

__host__ faiss::gpu::DeviceTensor< T, Dim, InnerContig, IndexT, PtrTraits >::DeviceTensor | ( | DataPtrType | data,
|  | const IndexT | sizes[Dim],
|  | const IndexT | strides[Dim],
|  | MemorySpace | space = `MemorySpace::Device`
| ) |  |

Constructs a tensor of the given size and stride, referencing a memory region we do not own

Definition at line 166 of file DeviceTensor-inl.cuh.

template<typename T, int Dim, bool InnerContig, typename IndexT, template< typename U > class PtrTraits>

__host__ faiss::gpu::DeviceTensor< T, Dim, InnerContig, IndexT, PtrTraits >::DeviceTensor | ( | DeviceMemory & | m,
|  | Tensor< T, Dim, InnerContig, IndexT, PtrTraits > & | t,
|  | cudaStream_t | stream,
|  | MemorySpace | space = `MemorySpace::Device`
| ) |  |

Copies a tensor into ourselves, reserving a temporary memory reservation via a memory manager.

Definition at line 195 of file DeviceTensor-inl.cuh.

The documentation for this class was generated from the following files:

- /data/users/matthijs/github_faiss/faiss/gpu/utils/DeviceTensor.cuh
- /data/users/matthijs/github_faiss/faiss/gpu/utils/DeviceTensor-inl.cuh