Mila
Deep Neural Network Library
Loading...
Searching...
No Matches
TensorHelpers.ixx File Reference

Provides utility functions for tensor initialization and manipulation. More...

#include <cuda_fp16.h>
#include <random>
#include <cmath>
#include <type_traits>
import Compute.CudaMemoryResource;
import Compute.CpuMemoryResource;
import Compute.MemoryResource;
import Dnn.TensorTraits;
import Dnn.Tensor;

Namespaces

namespace  Mila
 
namespace  Mila::Dnn
 

Functions

template<typename TElementType , typename MR = Compute::CpuMemoryResource>
requires ValidTensorType<TElementType> && std::is_base_of_v<Compute::MemoryResource, MR>
void Mila::Dnn::random (Tensor< TElementType, MR > &tensor, TElementType min, TElementType max)
 Initializes a tensor with random values within a specified range.
 
template<typename TElementType , typename MR >
requires ValidTensorType<TElementType>&& std::is_base_of_v<Compute::MemoryResource, MR>
void Mila::Dnn::xavier (Tensor< TElementType, MR > &tensor, size_t input_size, size_t output_size)
 Initializes a tensor with Xavier/Glorot uniform initialization.
 

Detailed Description

Provides utility functions for tensor initialization and manipulation.