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

Function IsNonNegative

tensorflow/compiler/xla/service/algebraic_simplifier.cc:127–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127bool IsNonNegative(const HloInstruction* hlo,
128 const AlgebraicSimplifierOptions& options) {
129 // Utility only handles real types.
130 if (IsAnyOperandComplex(hlo)) {
131 return false;
132 }
133 switch (hlo->opcode()) {
134 case HloOpcode::kMultiply: {
135 return hlo->operand(0) == hlo->operand(1);
136 }
137 case HloOpcode::kAbs: {
138 return true;
139 }
140 default:
141 return IsPositive(hlo, options);
142 }
143}
144
145// Checks whether `op` is a floating-point constant or broadcast of a constant
146// of the form +/- 2^k for some integer k positive, negative, or zero. Such

Callers 1

HandleAbsMethod · 0.85

Calls 4

IsAnyOperandComplexFunction · 0.85
IsPositiveFunction · 0.85
opcodeMethod · 0.80
operandMethod · 0.45

Tested by

no test coverage detected