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

Method SetFromDouble

tensorflow/compiler/xla/literal.cc:938–959  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

936}
937
938Status MutableLiteralBase::SetFromDouble(absl::Span<const int64> multi_index,
939 double value) {
940 CHECK(LayoutUtil::IsDenseArray(shape()));
941 switch (shape().element_type()) {
942 case F16:
943 Set<half>(multi_index, Eigen::half(value));
944 break;
945 case F32:
946 Set<float>(multi_index, value);
947 break;
948 case F64:
949 Set<double>(multi_index, value);
950 break;
951 case BF16:
952 Set<bfloat16>(multi_index, static_cast<bfloat16>(value));
953 break;
954 default:
955 return FailedPrecondition("Array element type is not floating: %s",
956 PrimitiveType_Name(shape().element_type()));
957 }
958 return Status::OK();
959}
960
961namespace {
962

Callers 1

Calls 4

FailedPreconditionFunction · 0.85
shapeFunction · 0.50
halfClass · 0.50
element_typeMethod · 0.45

Tested by

no test coverage detected