class dnnl::graph::tensor

Overview

A tensor object. More…

#include <dnnl_graph.hpp>

class tensor: public tensor_handle
{
public:
    // construction

    tensor();
    tensor(const logical_tensor& lt, const engine& aengine, void* handle);

    // methods

    void* get_data_handle() const;
    void set_data_handle(void* handle);
    engine get_engine() const;
};

Detailed Documentation

A tensor object.

Construction

tensor()

Default constructor. Constructs an empty object.

tensor(const logical_tensor& lt, const engine& aengine, void* handle)

Constructs a tensor object according to a given logical tensor, an engine, and a memory handle.

Parameters:

lt

The given logical tensor

aengine

Engine to store the data on.

handle

Handle of memory buffer to use as an underlying storage.

Methods

void* get_data_handle() const

Returns the underlying memory buffer.

On the CPU engine, or when using USM, this is a pointer to the allocated memory.

void set_data_handle(void* handle)

Sets the underlying memory handle.

Parameters:

handle

Memory handle.

engine get_engine() const

Returns the associated engine.

Returns:

An engine object