8000 Reverts 6414ceae4eac0d8c0703f3c4cb3b6e8907427371 · IBMZ-Linux-OSS-Python/tensorflow@ddff116 · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit ddff116

Browse files
Reverts 6414cea
PiperOrigin-RevId: 766282719
1 parent dd0389e commit ddff116

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

tensorflow/core/grappler/optimizers/auto_mixed_precision.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1865,9 +1865,8 @@ void AutoMixedPrecisionImpl::PropagateAllowThroughClear(
18651865
void AutoMixedPrecisionImpl::AddInferToAllowIfFollowAllow(
18661866
const absl::flat_hash_set<int>& deny_set,
18671867
absl::flat_hash_set<int>* allow_set) const {
1868-
// Currently only target for oneDNN (BF16 on CPU) and CUDA (FP16 on GPU).
1869-
if (mode_ != AutoMixedPrecisionMode::BF16 &&
1870-
mode_ != AutoMixedPrecisionMode::CUDA) {
1868+
// Currently only target for oneDNN
1869+
if (mode_ != AutoMixedPrecisionMode::BF16) {
18711870
return;
18721871
}
18731872
for (int item_idx = 0; item_idx < graph_type_view_.num_nodes(); ++item_idx) {

tensorflow/core/grappler/optimizers/auto_mixed_precision_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,15 +535,15 @@ TEST_P(AutoMixedPrecisionParamTest, PreserveCPUNodes) {
535535
EXPECT_EQ(output_view.GetNode("input")->attr().at("dtype").type(), DT_FLOAT);
536536
EXPECT_EQ(output_view.GetNode("clr1")->attr().at("T").type(), DT_HALF);
537537
EXPECT_EQ(output_view.GetNode("allow1")->attr().at("T").type(), DT_HALF);
538-
EXPECT_EQ(output_view.GetNode("infer1")->attr().at("T").type(), DT_HALF);
538+
EXPECT_EQ(output_view.GetNode("infer1")->attr().at("T").type(), DT_FLOAT);
539539
EXPECT_EQ(output_view.GetNode("allow2")->attr().at("T").type(), DT_FLOAT);
540540
EXPECT_EQ(output_view.GetNode("clr2")->attr().at("T").type(), DT_FLOAT);
541541

542542
auto tensors = EvaluateNodes(output, item.fetch);
543543
EXPECT_EQ(tensors.size(), tensors_expected.size());
544544
EXPECT_EQ(tensors.size(), item.fetch.size());
545545
for (int i = 0; i < item.fetch.size(); ++i) {
546-
test::ExpectTensorNear<float>(tensors_expected[i], tensors[i], 1e-4);
546+
test::ExpectTensorNear<float>(tensors_expected[i], tensors[i], 1e-6);
547547
}
548548
}
549549

tensorflow/python/grappler/auto_mixed_precision_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ def test_conv_pool(self, mode):
583583
self._assert_output_f16(mode, node_map, 'Relu')
584584
self._assert_output_f16(mode, node_map, 'MaxPool')
585585
self._assert_output_f16(mode, node_map, 'Conv2D_1')
586-
self.assertEqual(num_to_f16, 5)
586+
self.assertEqual(num_to_f16, 4)
587587
self.assertEqual(num_to_fp32, 1)
588588
tol = 5e-3 if mode == 'mkl' else 1e-3
589589
self.assertAllClose(output_val_ref, output_val, atol=tol, rtol=tol)

0 commit comments

Comments
 (0)
0