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

Method GetOrCreateMul

tensorflow/compiler/tf2xla/xla_context.cc:127–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127const xla::XlaComputation* XlaContext::GetOrCreateMul(const DataType type) {
128 return LookupOrCreate(type, &mul_func_, [type] {
129 const string type_string = DataTypeString(type);
130 VLOG(1) << "Building Mul() for " << type_string;
131 xla::XlaBuilder b("mul<" + type_string + ">");
132 xla::PrimitiveType xla_type;
133 TF_CHECK_OK(DataTypeToPrimitiveType(type, &xla_type));
134 auto x =
135 xla::Parameter(&b, 0, xla::ShapeUtil::MakeShape(xla_type, {}), "x");
136 auto y =
137 xla::Parameter(&b, 1, xla::ShapeUtil::MakeShape(xla_type, {}), "y");
138 xla::Mul(x, y);
139 return b.Build().ConsumeValueOrDie();
140 });
141}
142
143const xla::XlaComputation* XlaContext::LookupOrCreate(
144 DataType type, ComputationMap* out,

Callers 1

CompileMethod · 0.45

Calls 8

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

Tested by

no test coverage detected