MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / PopulateFromArray

Method PopulateFromArray

tensorflow/compiler/xla/literal.h:961–972  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

959
960template <typename NativeT>
961void MutableLiteralBase::PopulateFromArray(const Array<NativeT>& values) {
962 CHECK(shape().IsArray());
963 CHECK_EQ(shape().element_type(),
964 primitive_util::NativeToPrimitiveType<NativeT>());
965 CHECK_EQ(shape().rank(), values.num_dimensions());
966 for (int dim = 0; dim < values.num_dimensions(); ++dim) {
967 CHECK_EQ(values.dim(dim), shape().dimensions(dim));
968 }
969 values.Each([this](absl::Span<const int64> indices, NativeT value) {
970 this->Set(indices, value);
971 });
972}
973
974template <typename NativeT>
975void MutableLiteralBase::PopulateR2FromArray2D(const Array2D<NativeT>& values) {

Callers 1

Calls 9

num_dimensionsMethod · 0.80
shapeFunction · 0.50
IsArrayMethod · 0.45
element_typeMethod · 0.45
rankMethod · 0.45
dimMethod · 0.45
dimensionsMethod · 0.45
EachMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected