class nbla::Context
-
class Context
Context structure.
It will be used specifying device and array class etc.
Public Functions
-
explicit NBLA_API Context(const vector<string> &backend = {"cpu:float"}, const string &array_class = "CpuArray", const string &device_id = "0")
A compute backend descriptor passed to Function/Solver or NdArray class.
- Parameters:
backend – [in]
A vector of backend description. A specific implementation of Function/Solver will be queried by each description, the first matched one is used. For each element, it describes the backend of computation and the data type config in a format of `<backend>:<data type
config>`. If only `backend` is given (`:<data type configuration>` is omitted), the default data type config (`:float`)is automatically added.
array_class – [in] Optional: A string expression of a preferred array class. Even if it is not specified an array class is chosen according to the default array class of an implementation of Function/Solver. Every Function/Solver class has a list of array classes that can be used as storage of the computation inputs and outputs. If the given array_class doesn’t match any of them, the default array class of the implementation will be used.
device_id – [in] A string expression of device ID of the backend.
-
explicit NBLA_API Context(const vector<string> &backend = {"cpu:float"}, const string &array_class = "CpuArray", const string &device_id = "0")