Function marian::inits::fromSparseVector¶
Defined in File node_initializers.cpp
Function Documentation¶
-
Ptr<NodeInitializer>
marian::inits
::
fromSparseVector
(std::pair<std::vector<size_t>, std::vector<float>> &v)¶ Initialize tensor from a given sparse vector.
Creates a NodeInitializer that will initialize the tensor from a given sparse vector (stored in std::pair). The resulting tensor is first filled with
1e-6
(a placeholder for non-zero element), then set the value to the given sparse vector.- Return
- Parameters
v
: the sparse vector is stored instd::pair
:the first object (v.first) holds the indexes (in a vector)
the second object (v.second) holds the corresponding values (in a vector). This means the value of the resulting tensor at index v.first[i] is v.second[i].