Crates.io | caffe2op-copy |
lib.rs | caffe2op-copy |
version | 0.1.5-alpha.0 |
source | src |
created_at | 2023-03-01 12:28:47.685463 |
updated_at | 2023-03-25 10:07:40.919936 |
description | xxx |
homepage | |
repository | https://github.com/kleb6/caffe2-rs |
max_upload_size | |
id | 797963 |
size | 88,976 |
This Rust crate provides operators and functions
for efficiently copying and manipulating data in
DSP and machine learning computations. One of the
core operators in this crate is
CopyRowsToTensorOp
, which copies a set of rows
from an input tensor to an output tensor, creating
a new tensor with the specified rows. The
CopyRowsToTensorGradientOp
performs the gradient
computation for this operation.
Note: This crate is currently being translated from C++ to Rust, and some function bodies may still be in the process of translation.
Other operators in this crate include
CopyCPUToGPUOp
, which copies data from a CPU
tensor to a GPU tensor, and CopyGPUToCPUOp
,
which performs the reverse operation. The
CopyOnDeviceLikeOp
copies data from one tensor
to another tensor on the same device, and the
Identity
operator simply returns its input as
its output.
This crate also provides functions for working
with blobs, including FeedBlob
and FetchBlob
,
which respectively load and retrieve data from
a blob, and ResetWorkspace
, which clears the
workspace of any previously loaded blobs.
CopyRowsToTensorOp
: The main operator of this
crate, which copies a set of rows from an input
tensor to an output tensor.
CopyRowsToTensorGradientOp
: The gradient
computation for CopyRowsToTensorOp
.
CopyCPUToGPUOp
: Copies data from a CPU tensor
to a GPU tensor.
CopyGPUToCPUOp
: Copies data from a GPU tensor
to a CPU tensor.
CopyOnDeviceLikeOp
: Copies data from one
tensor to another tensor on the same device.
Identity
: Returns its input as its output.
FeedBlob
: Loads data into a blob.
FetchBlob
: Retrieves data from a blob.
ResetWorkspace
: Clears the workspace of any
previously loaded blobs.
The CopyRowsToTensorOp
operator can be expressed
mathematically as follows, where input
and
output
are the input and output tensors,
respectively, and rows
is a vector specifying
which rows to copy:
output[i, :] = input[rows[i], :]
The gradient computation for this operation,
CopyRowsToTensorGradientOp
, can be expressed
mathematically as follows:
grad_input[rows[i], :] += grad_output[i, :]
where grad_input
and grad_output
are the
gradient tensors for the input and output,
respectively.