Turi Create  4.0
turi::neural_net::compute_context Class Referenceabstract

#include <ml/neural_net/compute_context.hpp>

Classes

class  registration
 

Public Types

using factory = std::function< std::unique_ptr< compute_context >()>
 

Public Member Functions

virtual void print_training_device_info () const =0
 
virtual size_t memory_budget () const =0
 
virtual std::unique_ptr< model_backendcreate_object_detector (int n, int c_in, int h_in, int w_in, int c_out, int h_out, int w_out, const float_array_map &config, const float_array_map &weights)
 
virtual std::unique_ptr< model_backendcreate_activity_classifier (const ac_parameters &ac_params)
 
virtual std::unique_ptr< model_backendcreate_style_transfer (const float_array_map &config, const float_array_map &weights)
 
virtual std::unique_ptr< model_backendcreate_drawing_classifier (const float_array_map &weights, size_t batch_size, size_t num_classes)
 
virtual std::unique_ptr< image_augmentercreate_image_augmenter (const image_augmenter::options &opts)
 
virtual std::unique_ptr< turi::neural_net::model_backendcreate_multilayer_perceptron_classifier (int n, int c_in, int c_out, const std::vector< size_t > &layer_sizes, const turi::neural_net::float_array_map &config)
 

Static Public Member Functions

static std::unique_ptr< compute_contextcreate ()
 

Detailed Description

Interface for factories that produce concrete data augmentation and neural network module instances, used to abstract across backend implementations and hardware resources.

Definition at line 55 of file compute_context.hpp.

Member Typedef Documentation

◆ factory

using turi::neural_net::compute_context::factory = std::function<std::unique_ptr<compute_context>()>

Function that yields a compute context.

Definition at line 58 of file compute_context.hpp.

Member Function Documentation

◆ create()

static std::unique_ptr<compute_context> turi::neural_net::compute_context::create ( )
static

Requests a compute_context from each registered compute_context::factory, in ascending order by "priority", until one returns non-nil. Factories should be registered so that this function yields a backend appropriate to the current platform and hardware.

◆ create_activity_classifier()

virtual std::unique_ptr<model_backend> turi::neural_net::compute_context::create_activity_classifier ( const ac_parameters ac_params)
inlinevirtual

Creates an activity classification network.

Reimplemented in turi::neural_net::mps_compute_context, and turi::neural_net::tf_compute_context.

Definition at line 145 of file compute_context.hpp.

◆ create_drawing_classifier()

virtual std::unique_ptr<model_backend> turi::neural_net::compute_context::create_drawing_classifier ( const float_array_map &  weights,
size_t  batch_size,
size_t  num_classes 
)
inlinevirtual

Creates a drawing classification network.

Reimplemented in turi::neural_net::mps_compute_context, and turi::neural_net::tf_compute_context.

Definition at line 173 of file compute_context.hpp.

◆ create_image_augmenter()

virtual std::unique_ptr<image_augmenter> turi::neural_net::compute_context::create_image_augmenter ( const image_augmenter::options opts)
inlinevirtual

Creates an image augmenter.

Reimplemented in turi::neural_net::mps_compute_context, and turi::neural_net::tf_compute_context.

Definition at line 182 of file compute_context.hpp.

◆ create_multilayer_perceptron_classifier()

virtual std::unique_ptr<turi::neural_net::model_backend> turi::neural_net::compute_context::create_multilayer_perceptron_classifier ( int  n,
int  c_in,
int  c_out,
const std::vector< size_t > &  layer_sizes,
const turi::neural_net::float_array_map &  config 
)
inlinevirtual

Creates a multilevel perceptron classifier.

Definition at line 191 of file compute_context.hpp.

◆ create_object_detector()

virtual std::unique_ptr<model_backend> turi::neural_net::compute_context::create_object_detector ( int  n,
int  c_in,
int  h_in,
int  w_in,
int  c_out,
int  h_out,
int  w_out,
const float_array_map &  config,
const float_array_map &  weights 
)
inlinevirtual

Creates an object detection network.

Reimplemented in turi::neural_net::mps_compute_context, and turi::neural_net::tf_compute_context.

Definition at line 129 of file compute_context.hpp.

◆ create_style_transfer()

virtual std::unique_ptr<model_backend> turi::neural_net::compute_context::create_style_transfer ( const float_array_map &  config,
const float_array_map &  weights 
)
inlinevirtual

Creates a style transfer network

Reimplemented in turi::neural_net::mps_compute_context, and turi::neural_net::tf_compute_context.

Definition at line 158 of file compute_context.hpp.

◆ memory_budget()

virtual size_t turi::neural_net::compute_context::memory_budget ( ) const
pure virtual

Provides a measure of the memory resources available.

Returns the maximum memory size in bytes that neural networks should allocate, typically used to determine batch sizes (often heuristically).

Implemented in turi::neural_net::mps_compute_context, and turi::neural_net::tf_compute_context.

◆ print_training_device_info()

virtual void turi::neural_net::compute_context::print_training_device_info ( ) const
pure virtual

Prints (human readable) device information.

Implemented in turi::neural_net::mps_compute_context, and turi::neural_net::tf_compute_context.


The documentation for this class was generated from the following file: