Deepity
Ultra-fast, SIMD-accelerated Predictive Coding
Loading...
Searching...
No Matches
Tensor.h File Reference

A device-aware, RAII-managed buffer. Device is fixed at construction – there is no support for moving a live Tensor between CPU and GPU after creation. Loading weights saved on CPU and running them on GPU doesn't need that: read the saved file into a plain std::vector on the host, then construct a DEVICE_GPU Tensor directly from that vector (see the host-data constructors below) – the one-time host-to-device copy happens inside the constructor, and the temporary host vector falls out of scope immediately after. The Tensor itself is a GPU object from the moment it's born. More...

#include <cstddef>
#include <vector>
#include <deepity/backend/IComputeBackend.h>
#include <deepity/backend/DeviceType.h>

Go to the source code of this file.

Classes

class  Deep::Tensor
 A device-aware, RAII-managed, move-only buffer – see the file-level note above for the full ownership/device contract. More...

Namespaces

namespace  Deep
 This file exists to provide both Tensor.h and IComputeBackend.h with device types without introducing circular dependencies.

Detailed Description

A device-aware, RAII-managed buffer. Device is fixed at construction – there is no support for moving a live Tensor between CPU and GPU after creation. Loading weights saved on CPU and running them on GPU doesn't need that: read the saved file into a plain std::vector on the host, then construct a DEVICE_GPU Tensor directly from that vector (see the host-data constructors below) – the one-time host-to-device copy happens inside the constructor, and the temporary host vector falls out of scope immediately after. The Tensor itself is a GPU object from the moment it's born.

Move-only, matching MemoryArena's own established RAII convention in this codebase (a Tensor owns a single device allocation; copying would risk a double-free).