Struct caffe2_context::CPUContext
source · pub struct CPUContext { /* private fields */ }
Expand description
| The CPU Context, representing the bare
| minimum of what a Context class in Caffe2
| should implement.
|
| // TODO modify docs
|
| See operator.h, especially Operator
Implementations§
source§impl CPUContext
impl CPUContext
pub fn supports_non_fundamental_types(&self) -> bool
pub fn device(&self) -> Device
pub fn device_type(&self) -> DeviceType
pub fn get_device_type() -> DeviceType
pub fn new(nbytes: usize) -> DataPtr
pub fn copy_bytes_fromCPU( &mut self, nbytes: usize, src: *const c_void, dst: *mut c_void )
pub fn copy_bytes_toCPU( &mut self, nbytes: usize, src: *const c_void, dst: *mut c_void )
pub fn copy<T, SrcContext, DstContext>( &mut self, n: usize, src: *const T, dst: *mut T )
pub fn copy_items<SrcContext, DstContext>( &mut self, meta: TypeMeta, n: usize, src: *const c_void, dst: *mut c_void )
sourcepub fn has_async_part_default() -> bool
pub fn has_async_part_default() -> bool
By default CPU operators don’t have async device parts
pub fn supports_async_scheduling() -> bool
sourcepub fn is_stream_free(option: &DeviceOption, stream_id: i32) -> bool
pub fn is_stream_free(option: &DeviceOption, stream_id: i32) -> bool
| CPU streams are not implemented and | are silently ignored by CPU ops, return | true to signal executor to schedule | a CPU op |
pub fn rand_generator(&mut self) -> *mut RandGenType
pub fn rand_seed(&mut self) -> u32
pub fn switch_to_device(&mut self, stream_id: i32)
pub fn wait_event(&mut self, ev: &Event)
pub fn record(&self, ev: *mut Event, err_msg: *const u8)
pub fn finish_device_computation(&mut self)
pub fn copy_bytes_same_device( &mut self, nbytes: usize, src: *const c_void, dst: *mut c_void )
pub fn copy_bytes(nbytes: usize, src: *const c_void, dst: *mut c_void)
Trait Implementations§
source§impl Default for CPUContext
impl Default for CPUContext
source§fn default() -> CPUContext
fn default() -> CPUContext
Returns the “default value” for a type. Read more
source§impl From<&Device> for CPUContext
impl From<&Device> for CPUContext
source§fn from(x: &Device) -> CPUContext
fn from(x: &Device) -> CPUContext
Converts to this type from the input type.
source§impl From<&DeviceOption> for CPUContext
impl From<&DeviceOption> for CPUContext
source§fn from(x: &DeviceOption) -> CPUContext
fn from(x: &DeviceOption) -> CPUContext
Converts to this type from the input type.
Auto Trait Implementations§
impl RefUnwindSafe for CPUContext
impl Send for CPUContext
impl Sync for CPUContext
impl Unpin for CPUContext
impl UnwindSafe for CPUContext
Blanket Implementations§
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.