pytorch/caffe2/core
Adam Simpkins ccdcfba5de [caffe2] Refactor tensor serialization function (#53404)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53404

This refactors `TensorSerializer::Serialize()` so that we have a separate
helper function for each data type.

This should make it slightly easier in the future to add new serialization
formats for specific data types.
ghstack-source-id: 124085413

Test Plan:
Confirmed the existing tests pass.  This diff is not expected to have any
behavior changes.

Reviewed By: mraway, glamtechie

Differential Revision: D26658204

fbshipit-source-id: 232776262db6486ba845a7ba223e3987053dac27
2021-03-17 12:36:31 -07:00
..
hip
nomnigraph use make_shared and make_unique and clean unneeded code (#51829) 2021-02-10 21:38:43 -08:00
__init__.py remediation of S205607 2020-07-17 17:19:47 -07:00
allocator.cc
allocator.h
blob.h
blob_gpu_test.cc
blob_serialization.cc [caffe2] Refactor tensor serialization function (#53404) 2021-03-17 12:36:31 -07:00
blob_serialization.h [caffe2] add a SerializationOptions field for the save operator (#53402) 2021-03-11 13:02:58 -08:00
blob_serialization_gpu.cc
blob_serializer_base.h [caffe2] add a SerializationOptions field for the save operator (#53402) 2021-03-11 13:02:58 -08:00
blob_stats.cc
blob_stats.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
blob_test.cc [caffe2] add a SerializationOptions field for the save operator (#53402) 2021-03-11 13:02:58 -08:00
CMakeLists.txt Compile less legacy code when BUILD_CAFFE2 is set to False (take 2) (#44453) 2020-09-11 16:27:47 -07:00
common.cc
common.h [caffe2] add a CAFFE2_NODISCARD macro to help support old compilers (#53754) 2021-03-12 11:32:30 -08:00
common_cudnn.cc
common_cudnn.h Fix signed-unsigned warnings (#34791) 2020-03-19 00:29:56 -07:00
common_gpu.cc [c10/cuda] Reorganize device_count() and robustly surface ASAN warnings (#42249) 2020-08-05 11:39:31 -07:00
common_gpu.h Introducing TORCH_CUDA_CPP_API and TORCH_CUDA_CU_API to the code (#50627) 2021-01-21 19:09:11 -08:00
common_omp.h
common_test.cc Forbid trailing whitespace (#53406) 2021-03-05 17:22:55 -08:00
context.cc
context.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
context_base.cc
context_base.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
context_gpu.cu use device methods (#52899) 2021-03-02 20:14:23 -08:00
context_gpu.h pass TypeMeta by value (#45026) 2020-10-30 10:14:17 -07:00
context_gpu_test.cc
context_test.cc
cudnn_wrappers.h
db.cc Properly format db.h and db.cc (#43027) 2020-08-24 18:29:45 -07:00
db.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
distributions_stubs.h caffe2: use at::mt19937 instead of std::mt19937 (10x speedup) (#43987) 2020-10-16 16:08:35 -07:00
event.cc Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
event.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
event_cpu.h
event_gpu.cc
event_gpu_test.cc
event_test.cc
export_c10_op_to_caffe2.cc
export_c10_op_to_caffe2.h Remove callBoxedWorkaround (#36850) 2020-04-24 23:13:31 -07:00
export_caffe2_op_to_c10.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
flags.h
graph.cc
graph.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
graph_test.cc
init.cc
init.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
init_denormals.cc
init_intrinsics_check.cc
init_omp.cc
init_test.cc
int8_serialization.cc
logging.h
macros.h
macros.h.in Move USE_NUMPY to more appropriate targets (#51143) 2021-01-27 15:44:12 -08:00
memonger.cc [caffe][memonger] Extend operator schema check to dag memonger (#48021) 2020-11-16 19:17:55 -08:00
memonger.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
module.cc
module.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
module_test.cc
net.cc [caffe2] adds Cancel to OperatorBase and NetBase (#44145) 2020-09-11 12:50:26 -07:00
net.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
net_async_base.cc Back out "Revert D20449887: [dt][caffe2] enable using smart exceptions in async nets" (#36172) 2020-04-13 11:31:52 -07:00
net_async_base.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
net_async_scheduling.cc [caffe2] adds Cancel to OperatorBase and NetBase (#44145) 2020-09-11 12:50:26 -07:00
net_async_scheduling.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
net_async_task.cc Fix signed-unsigned warnings (#34791) 2020-03-19 00:29:56 -07:00
net_async_task.h
net_async_task_future.cc
net_async_task_future.h
net_async_task_graph.cc
net_async_task_graph.h
net_async_tracing.cc
net_async_tracing.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
net_async_tracing_test.cc
net_dag_utils.cc
net_dag_utils.h
net_dag_utils_test.cc
net_gpu_test.cc
net_parallel.cc Fix signed-unsigned warnings (#34791) 2020-03-19 00:29:56 -07:00
net_parallel.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
net_simple.cc [Caffe2] Implement BlackBoxPredictor::BenchmarkIndividualOps (#52903) 2021-02-27 19:49:22 -08:00
net_simple.h [Caffe2] Implement BlackBoxPredictor::BenchmarkIndividualOps (#52903) 2021-02-27 19:49:22 -08:00
net_simple_refcount.cc Fix signed-unsigned warnings (#34791) 2020-03-19 00:29:56 -07:00
net_simple_refcount.h
net_simple_refcount_test.cc
net_test.cc Back out "Revert D20449887: [dt][caffe2] enable using smart exceptions in async nets" (#36172) 2020-04-13 11:31:52 -07:00
numa.cc
numa.h
observer.h
observer_test.cc
operator.cc Move OperatorBase::AddRelatedBlobInfo implementation to .cc file (#40844) 2020-07-01 11:48:15 -07:00
operator.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
operator_gpu_test.cc
operator_gradient.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
operator_schema.cc Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
operator_schema.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
operator_schema_test.cc
operator_test.cc Make msg() and msg_with_backtrace() private (#37094) 2020-05-04 11:54:34 -07:00
parallel_net_test.cc [Caffe2] Increase timing threshold to 50 ms on Windows (#37892) 2020-05-05 19:45:36 -07:00
plan_executor.cc pass TypeMeta by value (#45026) 2020-10-30 10:14:17 -07:00
plan_executor.h
plan_executor_test.cc [caffe2] plan_executor_test: add test case for should_stop loops (#47613) 2020-11-16 12:59:13 -08:00
prof_dag_counters.cc Fix signed-unsigned warnings (#34791) 2020-03-19 00:29:56 -07:00
prof_dag_counters.h Fix signed-unsigned warnings (#34791) 2020-03-19 00:29:56 -07:00
qtensor.cc
qtensor.h Use sum_integers and multiply_integers (#51146) 2021-02-10 18:05:45 -08:00
qtensor_serialization.cc
qtensor_serialization.h
scope_guard.h
serialization_test.cc [caffe2] fix deserialization of unknown tensor data_type values (#52411) 2021-02-17 19:13:43 -08:00
static_tracepoint.h
static_tracepoint_elfx86.h
stats.cc use make_shared and make_unique and clean unneeded code (#51829) 2021-02-10 21:38:43 -08:00
stats.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
stats_test.cc
storage.h
tensor.cc Removing non-thread-safe log statement from ReinitializeTensor (#48185) 2020-11-18 17:42:22 -08:00
tensor.h [caffe2] Don't call TensorImpl::size() in dim32() (#53852) 2021-03-12 16:22:29 -08:00
tensor_impl.h
tensor_int8.cc
tensor_int8.h
test_utils.cc
test_utils.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
timer.h
timer_test.cc raise windows tol to 30% (#51733) 2021-02-04 14:09:10 -08:00
transform.cc
transform.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
transform_test.cc
types.cc pass TypeMeta by value (#45026) 2020-10-30 10:14:17 -07:00
types.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
workspace.cc [caffe2] Avoid some double (and triple) lookups in workspace (#53319) 2021-03-04 22:57:02 -08:00
workspace.h [caffe2] Avoid some double (and triple) lookups in workspace (#53319) 2021-03-04 22:57:02 -08:00
workspace_test.cc