nnlib
GPU-accelerated, C/C++ neural network library.
Functions
tensor.cpp File Reference

Source file defining methods related to the Tensor class. More...

#include "tensor.h"
#include "../gpu/allocation_gpu.cuh"
#include "cache.h"
#include "runtime.h"
#include "tensor_operations_on_device.cuh"
#include "tensor_operations_on_host.h"
#include <exceptions/different_data_location_exception.h>
#include <exceptions/size_mismatch_exception.h>
#include <exceptions/unsupported_operation_exception.h>
#include <functions.h>
#include <memory>
#include <queue>
#include <string>
#include <utils/location_verifiers.h>

Functions

bool canBackPropagate (const Tensor &tensor)
 
std::string tensorShapeToString (const Tensor &tensor)
 Convert the shape of the tensor to a string. More...
 
std::ostream & operator<< (std::ostream &stream, const Tensor &tensor)
 Enables the tensor to be printed using std::cout. More...
 

Detailed Description

Source file defining methods related to the Tensor class.

Author
Jan Warchocki
Date
26 August 2022

Function Documentation

◆ operator<<()

std::ostream& operator<< ( std::ostream &  stream,
const Tensor tensor 
)

Enables the tensor to be printed using std::cout.

Parameters
streamThe stream to print the tensor to.
tensorThe tensor to print.
Returns
The stream with the string representation of the tensor added to it.

◆ tensorShapeToString()

std::string tensorShapeToString ( const Tensor tensor)

Convert the shape of the tensor to a string.

The shape is displayed in the format: [2, 2, 3].

Parameters
tensorThe tensor whose shape to show as a string.
Returns
The string representation of the shape of the tensor.