Saving and Loading Profile

torch.profile can be export_chrome_trace as shown here. However, I am wondering if there is a way to import somehow a profile object.

I tried to import it with, however I didn’t have success, as shown below.

    482     pickler = pickle_module.Pickler(data_buf, protocol=pickle_protocol)
    483     pickler.persistent_id = persistent_id
--> 484     pickler.dump(obj)
    485     data_value = data_buf.getvalue()
    486     zip_file.write_record('data.pkl', data_value, len(data_value))

AttributeError: Can't pickle local object 'schedule.<locals>.schedule_fn'

Is there a way to save and load a profile object?