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

Method PopulateR2

tensorflow/compiler/xla/literal.h:936–958  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

934
935template <typename NativeT>
936void MutableLiteralBase::PopulateR2(
937 std::initializer_list<std::initializer_list<NativeT>> values) {
938 CHECK(shape().IsArray());
939 CHECK_EQ(shape().rank(), 2);
940 CHECK_EQ(shape().element_type(),
941 primitive_util::NativeToPrimitiveType<NativeT>());
942
943 const int64 dim0_size = values.size();
944 const int64 dim1_size = values.begin()->size();
945 CHECK_EQ(dim0_size, shape().dimensions(0));
946 CHECK_EQ(dim1_size, shape().dimensions(1));
947
948 int64 dim0 = 0;
949 for (auto inner_list : values) {
950 int64 dim1 = 0;
951 for (auto value : inner_list) {
952 Set({dim0, dim1}, value);
953 ++dim1;
954 }
955 CHECK_EQ(dim1_size, dim1);
956 ++dim0;
957 }
958}
959
960template <typename NativeT>
961void MutableLiteralBase::PopulateFromArray(const Array<NativeT>& values) {

Callers 1

CreateR2WithLayoutMethod · 0.80

Calls 8

shapeFunction · 0.50
SetFunction · 0.50
IsArrayMethod · 0.45
rankMethod · 0.45
element_typeMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
dimensionsMethod · 0.45

Tested by

no test coverage detected