H13-311_V3.5 · Question #89
None of the following options TensorFlow2.0. The supported operators are:
The correct answer is C. ^. Option C (^) is the unsupported operator because in Python, ^ is the bitwise XOR operator - not exponentiation - and TensorFlow 2.0 does not overload it for tensor operations, so using it will raise a TypeError. The distractors are wrong because TensorFlow 2.0 does support all…
Question
None of the following options TensorFlow2.0. The supported operators are:
Options
- Apow
- B@
- C^
- D//
How the community answered
(48 responses)- A6% (3)
- B4% (2)
- C77% (37)
- D13% (6)
Explanation
Option C (^) is the unsupported operator because in Python, ^ is the bitwise XOR operator - not exponentiation - and TensorFlow 2.0 does not overload it for tensor operations, so using it will raise a TypeError.
The distractors are wrong because TensorFlow 2.0 does support all three of them: pow (A) is supported via tf.pow() and the ** operator; @ (B) is the PEP 465 matrix multiplication operator, which TF2 maps to tf.linalg.matmul; and // (D) is the floor division operator, also overloaded for tensors.
Memory tip: The trap is assuming ^ means "to the power of" - it does in math notation, but in Python it's XOR. Ask yourself: "Does TF need to support XOR on tensors?" - not as a standard arithmetic operator, so it's the odd one out.
Topics
Community Discussion
No community discussion yet for this question.