commit | 0ca029b22d17d236d34bcecad44b94b35b1af4bb | [log] [tgz] |
---|---|---|
author | Giuseppe Ottaviano <ott@fb.com> | Mon Mar 08 08:30:16 2021 -0800 |
committer | Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> | Mon Mar 08 08:34:39 2021 -0800 |
tree | 4a8d644eaf58240df7fcd80547aefc13f6acd21d | |
parent | d54be1a9467db5075256d229ea1b01f1a4bcba8d [diff] |
[caffe2] Fix DBFileReader (#53498) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/53498 This code depended on `Blobs()` being returned in sorted order: https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/fbcode/caffe2/caffe2/python/db_file_reader.py?commit=472774e7f507e124392491800d9654e01269cbaf&lines=89-91 But D26504408 (https://github.com/pytorch/pytorch/commit/69bb0e028596d481cda38a0f49bcb5965fab4293) changed the underlying storage to a hashmap, so now the blobs are returned in arbitrary order (Note that `Blobs()` returns also non-local blobs, and for those there was already no guarantee of ordering). So we need to explicitly sort the result. Test Plan: ``` $ buck test dper3/dper3/toolkit/tests:lime_test $ buck test //dper3/dper3/toolkit/tests:model_insight_test ``` Pass after this diff. Differential Revision: D26879502 fbshipit-source-id: d76113f8780544af1d97ec0a818fb21cc767f2bf
diff --git a/caffe2/python/db_file_reader.py b/caffe2/python/db_file_reader.py index 265b192..49b1609 100644 --- a/caffe2/python/db_file_reader.py +++ b/caffe2/python/db_file_reader.py
@@ -118,7 +118,7 @@ ) ) col_names = [ - blob_name[len(blob_prefix):] for blob_name in workspace.Blobs() + blob_name[len(blob_prefix):] for blob_name in sorted(workspace.Blobs()) if blob_name.startswith(blob_prefix) ] schema = from_column_list(col_names)