PyTorch
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Friends | List of all members
at::TensorMaker Class Reference

Provides a fluent API to construct tensors from external data. More...

#include <from_blob.h>

Public Types

using ContextDeleter = DeleterFnPtr
 

Public Member Functions

TensorMakerstrides (OptionalIntArrayRef value) noexcept
 
TensorMakerstorage_offset (optional< int64_t > value) noexcept
 
TensorMakerdeleter (std::function< void(void *)> value) noexcept
 
TensorMakercontext (void *value, ContextDeleter deleter=nullptr) noexcept
 
TensorMakertarget_device (optional< Device > value) noexcept
 
TensorMakeroptions (TensorOptions value) noexcept
 
Tensor make_tensor ()
 

Friends

TensorMaker for_blob (void *data, IntArrayRef sizes) noexcept
 

Detailed Description

Provides a fluent API to construct tensors from external data.

The fluent API can be used instead of from_blob functions in case the required set of parameters does not align with the existing overloads.

at::Tensor tensor = at::for_blob(data, sizes)
        .strides(strides)
        .context(context, [](void *ctx) { delete static_cast<Ctx*>(ctx); })
        .options(...)
        .make_tensor();

Member Typedef Documentation

◆ ContextDeleter

using at::TensorMaker::ContextDeleter = DeleterFnPtr

Member Function Documentation

◆ context()

TensorMaker & at::TensorMaker::context ( void *  value,
ContextDeleter  deleter = nullptr 
)
inlinenoexcept

◆ deleter()

TensorMaker & at::TensorMaker::deleter ( std::function< void(void *)>  value)
inlinenoexcept

◆ make_tensor()

Tensor at::TensorMaker::make_tensor ( )

◆ options()

TensorMaker & at::TensorMaker::options ( TensorOptions  value)
inlinenoexcept

◆ storage_offset()

TensorMaker & at::TensorMaker::storage_offset ( optional< int64_t >  value)
inlinenoexcept

◆ strides()

TensorMaker & at::TensorMaker::strides ( OptionalIntArrayRef  value)
inlinenoexcept

◆ target_device()

TensorMaker & at::TensorMaker::target_device ( optional< Device >  value)
inlinenoexcept

Friends And Related Function Documentation

◆ for_blob

TensorMaker for_blob ( void *  data,
IntArrayRef  sizes 
)
friend

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