The CPU Context, representing the bare minimum of what a Context class in Caffe2 should implement. More...
#include <context.h>
Public Types | |
| typedef std::mt19937 | rand_gen_type |
Public Member Functions | |
| CPUContext (const DeviceOption &option) | |
| CPUContext (const at::Device &device) | |
| void | SwitchToDevice (int) override |
| void | WaitEvent (const Event &ev) override |
| void | Record (Event *ev, const char *err_msg=nullptr) const override |
| void | FinishDeviceComputation () override |
| rand_gen_type & | RandGenerator () |
| void | CopyBytesSameDevice (size_t nbytes, const void *src, void *dst) override |
| void | CopyBytesFromCPU (size_t nbytes, const void *src, void *dst) override |
| void | CopyBytesToCPU (size_t nbytes, const void *src, void *dst) override |
| bool | SupportsNonFundamentalTypes () const override |
| template<class SrcContext , class DstContext > | |
| void | CopyBytes (size_t nbytes, const void *src, void *dst) |
| template<typename T , class SrcContext , class DstContext > | |
| void | Copy (size_t n, const T *src, T *dst) |
| template<class SrcContext , class DstContext > | |
| void | CopyItems (const TypeMeta &meta, size_t n, const void *src, void *dst) |
| at::Device | device () const override |
| DeviceType | device_type () const override |
| template<> | |
| void | CopyBytes (size_t nbytes, const void *src, void *dst) |
Public Member Functions inherited from at::BaseContext | |
| void | SwitchToDevice () |
| template<typename T > | |
| void | CopySameDevice (size_t n, const T *src, T *dst) |
| template<typename T > | |
| void | CopyFromCPU (size_t n, const T *src, T *dst) |
| template<typename T > | |
| void | CopyToCPU (size_t n, const T *src, T *dst) |
| void | EnforceMetaCopyOK () |
| void | CopyItemsSameDevice (const caffe2::TypeMeta &meta, size_t n, const void *src, void *dst) |
| void | CopyItemsFromCPU (const caffe2::TypeMeta &meta, size_t n, const void *src, void *dst) |
| void | CopyItemsToCPU (const caffe2::TypeMeta &meta, size_t n, const void *src, void *dst) |
Static Public Member Functions | |
| static at::DataPtr | New (size_t nbytes) |
| static bool | HasAsyncPartDefault () |
| static bool | SupportsAsyncScheduling () |
| static bool | IsStreamFree (const DeviceOption &, int) |
| static constexpr DeviceType | GetDeviceType () |
Protected Attributes | |
| int | random_seed_ {1701} |
| std::unique_ptr< rand_gen_type > | random_generator_ |
The CPU Context, representing the bare minimum of what a Context class in Caffe2 should implement.
// TODO modify docs See operator.h, especially Operator<Context>, for how Context are used in actual operator implementations that are associated with specific devices. In general, the Context class is passed in as a template argument, and the operator can use the functions defined in the context to execute whatever computation it has.
1.8.11