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

Device-dispatched fast zero operation for tensor buffers. More...

Namespaces

namespace  Mila
 Mila main API namespace.

Functions

template<TensorDataType TDataType, typename TMemoryResource>
requires isValidTensor<TDataType, TMemoryResource>
void Mila::Dnn::zero (Tensor< TDataType, TMemoryResource > &tensor, IExecutionContext *exec_context=nullptr)
 Zero a tensor using the fastest backend implementation.

Detailed Description

Device-dispatched fast zero operation for tensor buffers.

Provides the high-level, device-agnostic entry point zero(...) that forwards to the backend TensorOps<device>::zero(...) implementation.

Function Documentation

◆ zero()

template<TensorDataType TDataType, typename TMemoryResource>
requires isValidTensor<TDataType, TMemoryResource>
void Mila::Dnn::zero ( Tensor< TDataType, TMemoryResource > & tensor,
IExecutionContext * exec_context = nullptr )
export

Zero a tensor using the fastest backend implementation.

Forwards to the device-specific TensorOps<device>::zero implementation.

Template Parameters
TDataTypeAbstract tensor data type.
TMemoryResourceMemory resource type backing the tensor.
Parameters
tensorDestination tensor to be zeroed.
exec_contextOptional execution context for stream control (borrowed).
Note
If exec_context is provided the backend should schedule the zero on the context's stream and avoid synchronizing. If exec_context is null the backend may synchronize before returning to provide synchronous semantics.