From 474adf5458e1ad917548e2e8ef28014dfc029ed1 Mon Sep 17 00:00:00 2001 From: Edward Yang Date: Wed, 20 Feb 2019 14:25:01 -0800 Subject: [PATCH] Minor doc updates in c10/core/Allocator.h (#17164) Summary: Signed-off-by: Edward Z. Yang Pull Request resolved: https://github.com/pytorch/pytorch/pull/17164 Differential Revision: D14154393 Pulled By: ezyang fbshipit-source-id: 59d8276d4bb4e7cadb4382769b75e5348ed388de --- c10/core/Allocator.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/c10/core/Allocator.h b/c10/core/Allocator.h index 426b6e8..b0c070c 100644 --- a/c10/core/Allocator.h +++ b/c10/core/Allocator.h @@ -169,7 +169,16 @@ struct C10_API Allocator { } }; -// Question: is this still needed? +// This context is used to generate DataPtr which have arbitrary +// std::function deleters associated with them. In some user facing +// functions, we give a (user-friendly) interface for constructing +// tensors from external data which take an arbitrary std::function +// deleter. Grep for InefficientStdFunctionContext to find these +// occurrences. +// +// This context is inefficient because we have to do a dynamic +// allocation InefficientStdFunctionContext, on top of the dynamic +// allocation which is implied by std::function itself. struct C10_API InefficientStdFunctionContext { std::unique_ptr> ptr_; InefficientStdFunctionContext( @@ -187,7 +196,7 @@ struct C10_API InefficientStdFunctionContext { * to an allocator of a particular device from being invalidated when * SetAllocator is called.) * - * Also note that this is not thraed-safe, and we assume this function will + * Also note that this is not thread-safe, and we assume this function will * only be called during initialization. */ C10_API void SetAllocator(DeviceType t, Allocator* alloc); -- 2.7.4