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

Method GetOrCreateMax

tensorflow/compiler/tf2xla/xla_context.cc:79–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79const xla::XlaComputation* XlaContext::GetOrCreateMax(const DataType type) {
80 return LookupOrCreate(type, &max_func_, [type] {
81 const string type_string = DataTypeString(type);
82 VLOG(1) << "Building Max() for " << type_string;
83 xla::XlaBuilder b("max<" + type_string + ">");
84 xla::PrimitiveType xla_type;
85 TF_CHECK_OK(DataTypeToPrimitiveType(type, &xla_type));
86 auto x =
87 xla::Parameter(&b, 0, xla::ShapeUtil::MakeShape(xla_type, {}), "x");
88 auto y =
89 xla::Parameter(&b, 1, xla::ShapeUtil::MakeShape(xla_type, {}), "y");
90 xla::Max(x, y);
91 return b.Build().ConsumeValueOrDie();
92 });
93}
94
95const xla::XlaComputation* XlaContext::GetOrCreateMin(const DataType type) {
96 return LookupOrCreate(type, &min_func_, [type] {

Callers 3

CompileMethod · 0.45
CompileMethod · 0.45
CrossEntropyWithLogitsFunction · 0.45

Calls 8

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

Tested by

no test coverage detected