torch_tensor_from_buffer: Creates a tensor from a buffer of memory

View source: R/tensor.R

torch_tensor_from_bufferR Documentation

Creates a tensor from a buffer of memory

Description

It creates a tensor without taking ownership of the memory it points to. You must call clone if you want to copy the memory over a new tensor.

Usage

torch_tensor_from_buffer(buffer, shape, dtype = "float")

buffer_from_torch_tensor(tensor)

Arguments

buffer

An R atomic object containing the data in a contiguous array.

shape

The shape of the resulting tensor.

dtype

A torch data type for the tresulting tensor.

tensor

Tensor object that will be converted into a buffer.

Functions

  • buffer_from_torch_tensor(): Creates a raw vector containing the tensor data. Causes a data copy.


torch documentation built on May 29, 2024, 9:54 a.m.