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

Method GetOrCreateAdd

tensorflow/compiler/tf2xla/xla_context.cc:111–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111const xla::XlaComputation* XlaContext::GetOrCreateAdd(const DataType type) {
112 return LookupOrCreate(type, &add_func_, [type] {
113 const string type_string = DataTypeString(type);
114 VLOG(1) << "Building Add() for " << type_string;
115 xla::XlaBuilder b("add<" + type_string + ">");
116 xla::PrimitiveType xla_type;
117 TF_CHECK_OK(DataTypeToPrimitiveType(type, &xla_type));
118 auto x =
119 xla::Parameter(&b, 0, xla::ShapeUtil::MakeShape(xla_type, {}), "x");
120 auto y =
121 xla::Parameter(&b, 1, xla::ShapeUtil::MakeShape(xla_type, {}), "y");
122 xla::Add(x, y);
123 return b.Build().ConsumeValueOrDie();
124 });
125}
126
127const xla::XlaComputation* XlaContext::GetOrCreateMul(const DataType type) {
128 return LookupOrCreate(type, &mul_func_, [type] {

Callers 10

CompileMethod · 0.45
CompileMethod · 0.45
CompileMethod · 0.45
CompileMethod · 0.45
CompileImplMethod · 0.45
CompileMethod · 0.45
CrossEntropyWithLogitsFunction · 0.45
CompileMethod · 0.45
CompileMethod · 0.45
CompileMethod · 0.45

Calls 8

LookupOrCreateFunction · 0.85
DataTypeToPrimitiveTypeFunction · 0.85
MakeShapeFunction · 0.85
ConsumeValueOrDieMethod · 0.80
DataTypeStringFunction · 0.50
ParameterFunction · 0.50
AddClass · 0.50
BuildMethod · 0.45

Tested by

no test coverage detected