Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[v1.x] Backport master #17673 to v1.x branch : change error tolerance for bf16 bn #18111

Merged
merged 1 commit into from
Apr 21, 2020
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
6 changes: 3 additions & 3 deletions tests/python/mkl/test_bf16_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ def test_bf16_bn():
bn_fp32 = mx.sym.BatchNorm(data_sym_fp32, **bn_params)

bn_bf16 = mx.sym.BatchNorm(data_sym_bf16, **bn_params)
check_operator_accuracy(sym_fp32=bn_fp32, sym_bf16=bn_bf16, data_shape=(3, 32, 28, 28), bf16_use_fp32_params=True, etol=1e-3)
check_operator_accuracy(sym_fp32=bn_fp32, sym_bf16=bn_bf16, data_shape=(32, 16, 64, 64), bf16_use_fp32_params=True, etol=1e-3)
check_operator_accuracy(sym_fp32=bn_fp32, sym_bf16=bn_bf16, data_shape=(3, 32, 28, 28), bf16_use_fp32_params=True, etol=1e-2)
check_operator_accuracy(sym_fp32=bn_fp32, sym_bf16=bn_bf16, data_shape=(32, 16, 64, 64), bf16_use_fp32_params=True, etol=1e-2)

@with_seed()
def test_bf16_conv():
Expand Down Expand Up @@ -278,7 +278,7 @@ def test_bf16_fallback():
bn_params = {"eps": 2e-05, "fix_gamma": False, "use_global_stats": True, "name": "bn"}
bn_fp32 = mx.sym.BatchNorm(data_sym_fp32, **bn_params)
bn_bf16=mx.sym.BatchNorm(data_sym_bf16, **bn_params)
check_operator_accuracy(sym_fp32=bn_fp32, sym_bf16=bn_bf16, data_shape=(3, 32, 28, 28, 3), bf16_use_fp32_params=True, etol=1e-3)
check_operator_accuracy(sym_fp32=bn_fp32, sym_bf16=bn_bf16, data_shape=(3, 32, 28, 28, 3), bf16_use_fp32_params=True, etol=1e-2)

conv_params = {"kernel": (3, 3, 3), "num_filter": 128, "pad": (1, 1, 1), "stride": (1, 1, 1), "no_bias": True, "name": "conv"}
conv_fp32 = mx.sym.Convolution(data_sym_fp32, **conv_params)
Expand Down