Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions test/amp/test_get_autocast_dtype.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,30 @@ def test_amp_autocast_fp16(self):
self.do_test(device, "float16")
self.do_test(device, self.default_dtype)

@unittest.skipIf(
not paddle.amp.is_bfloat16_supported(),
"Skip BF16 test if BF16 is not supported",
)
def test_amp_autocast_bf16(self):
for device in self.device_list:
with paddle.amp.auto_cast(True, dtype="bfloat16"):
self.do_test(device, "bfloat16")
self.do_test(device, self.default_dtype)

@unittest.skipIf(
not paddle.amp.is_bfloat16_supported(),
"Skip BF16 test if BF16 is not supported",
)
def test_amp_autocast_false_bf16(self):
for device in self.device_list:
with paddle.amp.auto_cast(True, dtype="bfloat16"):
self.do_test(device, "bfloat16")
self.do_test(device, self.default_dtype)

@unittest.skipIf(
not paddle.amp.is_bfloat16_supported(),
"Skip BF16 test if BF16 is not supported",
)
def test_amp_nested_context(self):
for device in self.device_list:
with paddle.amp.auto_cast(True, dtype="bfloat16"):
Expand Down
Loading