yangulei commented on a change in pull request #10112:
URL: https://github.com/apache/tvm/pull/10112#discussion_r803333719



##########
File path: src/relay/op/nn/nn.cc
##########
@@ -1177,7 +1177,8 @@ bool NLLLossRel(const Array<Type>& types, int num_inputs, 
const Attrs& attrs,
                                      << ", weights shape = " << 
weights->shape);
     return false;
   }
-  if (!(predictions->dtype == weights->dtype && 
predictions->dtype.is_float())) {
+  if (!(predictions->dtype == weights->dtype &&
+        (predictions->dtype.is_float() || predictions->dtype.is_bfloat16()))) {

Review comment:
       I prefer this way too, since they **are** all floating-point datatypes.
   While there are some practical inconsistences so far, for example, if we let 
`is_float() == true` for `bfloat16`, then we cannot distinguish `bfloat16` and 
`float16` anymore as they both satisfy the condition `is_float() == true && 
bits() == 16`.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to