def test_report_serialization(): mod, params = mlp.get_workload(1) exe = relay.vm.compile(mod, "llvm", params=params) vm = profiler_vm.VirtualMachineProfiler(exe, tvm.cpu()) data = np.random.rand(1, 1, 28, 28).astype("float32") report = vm.profile(data, func_name="main") report2 = Report.from_json(report.json()) # equality on reports compares pointers, so we compare the printed results instead. assert str(report) == str(report2)
def test_report_serialization(): mod, params = mlp.get_workload(1) exe = relay.vm.compile(mod, "llvm", params=params) vm = profiler_vm.VirtualMachineProfiler(exe, tvm.cpu()) data = np.random.rand(1, 1, 28, 28).astype("float32") report = vm.profile(data, func_name="main") report2 = Report.from_json(report.json()) # Equality on reports compares pointers, so we compare the printed # results instead. # Use .table() instead of str(), because str() includes aggregate # and column summations whose values may be impacted by otherwise # negligible conversion errors. (2 occurrences / 3000 trials) assert report.table(aggregate=False, col_sums=False) == report2.table(aggregate=False, col_sums=False)