[][src]Struct tensorflow_proto::tensorflow::RewriterConfig

pub struct RewriterConfig {
    pub layout_optimizer: i32,
    pub constant_folding: i32,
    pub shape_optimization: i32,
    pub remapping: i32,
    pub arithmetic_optimization: i32,
    pub dependency_optimization: i32,
    pub loop_optimization: i32,
    pub function_optimization: i32,
    pub debug_stripper: i32,
    pub disable_model_pruning: bool,
    pub scoped_allocator_optimization: i32,
    pub pin_to_host_optimization: i32,
    pub implementation_selector: i32,
    pub auto_mixed_precision: i32,
    pub disable_meta_optimizer: bool,
    pub meta_optimizer_iterations: i32,
    pub min_graph_nodes: i32,
    pub memory_optimization: i32,
    pub memory_optimizer_target_node_name_scope: String,
    pub meta_optimizer_timeout_ms: i64,
    pub auto_parallel: Option<AutoParallelOptions>,
    pub fail_on_optimizer_errors: bool,
    pub scoped_allocator_opts: Option<ScopedAllocatorOptions>,
    pub optimizers: Vec<String>,
    pub custom_optimizers: Vec<CustomGraphOptimizer>,
    pub inter_optimizer_verifier_config: Option<VerifierConfig>,
    pub post_optimization_verifier_config: Option<VerifierConfig>,
}

Graph rewriting is experimental and subject to change, not covered by any API stability guarantees.

Fields

layout_optimizer: i32

Optimize tensor layouts (default is ON) e.g. This will try to use NCHW layout on GPU which is faster.

constant_folding: i32

Fold constants (default is ON) Statically infer the value of tensors when possible, and materialize the result using constants.

shape_optimization: i32

Shape optimizations (default is ON) Simplify computations made on shapes.

remapping: i32

Remapping (default is ON) Remap subgraphs onto more efficient implementations.

arithmetic_optimization: i32

Arithmetic optimizations (default is ON) e.g. Simplify arithmetic ops; merge ops with same value (like constants).

dependency_optimization: i32

Control dependency optimizations (default is ON). Remove redundant control dependencies, which may enable other optimization.

loop_optimization: i32

Loop optimizations (default is ON).

function_optimization: i32

Function optimizations (default is ON).

debug_stripper: i32

Strips debug-related nodes from the graph (off by default).

disable_model_pruning: bool

If true, don't remove unnecessary ops from the graph

scoped_allocator_optimization: i32

Try to allocate some independent Op outputs contiguously in order to merge or eliminate downstream Ops (off by default).

pin_to_host_optimization: i32

Force small ops onto the CPU (default is OFF).

implementation_selector: i32

Enable the swap of kernel implementations based on the device placement (default is ON).

auto_mixed_precision: i32

Optimize data types (default is OFF). e.g., This will try to use float16 on GPU which is faster. Note that this can change the numerical stability of the graph and may require the use of loss scaling to maintain model convergence.

disable_meta_optimizer: bool

Disable the entire meta optimizer (off by default).

meta_optimizer_iterations: i32

Controls how many times we run the optimizers in meta optimizer (default is once).

min_graph_nodes: i32

The minimum number of nodes in a graph to optimizer. For smaller graphs, optimization is skipped. 0 means the system picks an appropriate number. < 0 means do not skip optimization.

memory_optimization: i32

Configures memory optimization passes through the meta-optimizer. Has no effect on manually requested memory optimization passes in the optimizers field.

memory_optimizer_target_node_name_scope: String

A node name scope for node names which are valid outputs of recompuations. Inputs to nodes that match this scope may be recomputed (subject either to manual annotation of those input nodes or to manual annotation and heuristics depending on memory_optimization), but the nodes themselves will not be recomputed. This matches any sub-scopes as well, meaning the scope can appear not just as a top-level scope. For example, if the value is "gradients/", the default, it will match node name "gradients/foo", "foo/gradients/bar", but not "foo_gradients/"

meta_optimizer_timeout_ms: i64

Maximum number of milliseconds to spend optimizing a single graph before timing out. If equal to 0 the system picks a default (currently 5 minutes). If less than 0 the optimizer will never time out.

auto_parallel: Option<AutoParallelOptions>

Configures AutoParallel optimization passes either through the meta-optimizer or when manually specified through the optimizers field.

fail_on_optimizer_errors: bool

If true, any optimization pass failing will cause the MetaOptimizer to stop with an error. By default - or when set to false, failing passes are skipped silently.

scoped_allocator_opts: Option<ScopedAllocatorOptions>optimizers: Vec<String>

If non-empty, will use this as an alternative way to specify a list of optimizations to turn on and the order of the optimizations (replacing the meta-optimizer).

Of the RewriterConfig options, only the AutoParallel configuration options (the auto_parallel field) apply to manually requested optimization passes ("autoparallel"). Memory optimization passes ("memory") invoked here are not configurable (in contrast to memory optimization passes through the meta-optimizer) and act only on manual op annotations.

Custom optimizers (see custom_optimizers) that are not part of this schedule will be run after - in the order that they were specified.

custom_optimizers: Vec<CustomGraphOptimizer>

list of CustomGraphOptimizers to apply.

inter_optimizer_verifier_config: Option<VerifierConfig>

VerifierConfig specifying the verifiers to be run after every optimizer.

post_optimization_verifier_config: Option<VerifierConfig>

VerifierConfig specifying the verifiers to be run at the end, after all optimizers have run.

Implementations

impl RewriterConfig[src]

pub fn layout_optimizer(&self) -> Toggle[src]

Returns the enum value of layout_optimizer, or the default if the field is set to an invalid enum value.

pub fn set_layout_optimizer(&mut self, value: Toggle)[src]

Sets layout_optimizer to the provided enum value.

pub fn constant_folding(&self) -> Toggle[src]

Returns the enum value of constant_folding, or the default if the field is set to an invalid enum value.

pub fn set_constant_folding(&mut self, value: Toggle)[src]

Sets constant_folding to the provided enum value.

pub fn memory_optimization(&self) -> MemOptType[src]

Returns the enum value of memory_optimization, or the default if the field is set to an invalid enum value.

pub fn set_memory_optimization(&mut self, value: MemOptType)[src]

Sets memory_optimization to the provided enum value.

pub fn arithmetic_optimization(&self) -> Toggle[src]

Returns the enum value of arithmetic_optimization, or the default if the field is set to an invalid enum value.

pub fn set_arithmetic_optimization(&mut self, value: Toggle)[src]

Sets arithmetic_optimization to the provided enum value.

pub fn dependency_optimization(&self) -> Toggle[src]

Returns the enum value of dependency_optimization, or the default if the field is set to an invalid enum value.

pub fn set_dependency_optimization(&mut self, value: Toggle)[src]

Sets dependency_optimization to the provided enum value.

pub fn loop_optimization(&self) -> Toggle[src]

Returns the enum value of loop_optimization, or the default if the field is set to an invalid enum value.

pub fn set_loop_optimization(&mut self, value: Toggle)[src]

Sets loop_optimization to the provided enum value.

pub fn function_optimization(&self) -> Toggle[src]

Returns the enum value of function_optimization, or the default if the field is set to an invalid enum value.

pub fn set_function_optimization(&mut self, value: Toggle)[src]

Sets function_optimization to the provided enum value.

pub fn debug_stripper(&self) -> Toggle[src]

Returns the enum value of debug_stripper, or the default if the field is set to an invalid enum value.

pub fn set_debug_stripper(&mut self, value: Toggle)[src]

Sets debug_stripper to the provided enum value.

pub fn meta_optimizer_iterations(&self) -> NumIterationsType[src]

Returns the enum value of meta_optimizer_iterations, or the default if the field is set to an invalid enum value.

pub fn set_meta_optimizer_iterations(&mut self, value: NumIterationsType)[src]

Sets meta_optimizer_iterations to the provided enum value.

pub fn shape_optimization(&self) -> Toggle[src]

Returns the enum value of shape_optimization, or the default if the field is set to an invalid enum value.

pub fn set_shape_optimization(&mut self, value: Toggle)[src]

Sets shape_optimization to the provided enum value.

pub fn remapping(&self) -> Toggle[src]

Returns the enum value of remapping, or the default if the field is set to an invalid enum value.

pub fn set_remapping(&mut self, value: Toggle)[src]

Sets remapping to the provided enum value.

pub fn scoped_allocator_optimization(&self) -> Toggle[src]

Returns the enum value of scoped_allocator_optimization, or the default if the field is set to an invalid enum value.

pub fn set_scoped_allocator_optimization(&mut self, value: Toggle)[src]

Sets scoped_allocator_optimization to the provided enum value.

pub fn pin_to_host_optimization(&self) -> Toggle[src]

Returns the enum value of pin_to_host_optimization, or the default if the field is set to an invalid enum value.

pub fn set_pin_to_host_optimization(&mut self, value: Toggle)[src]

Sets pin_to_host_optimization to the provided enum value.

pub fn implementation_selector(&self) -> Toggle[src]

Returns the enum value of implementation_selector, or the default if the field is set to an invalid enum value.

pub fn set_implementation_selector(&mut self, value: Toggle)[src]

Sets implementation_selector to the provided enum value.

pub fn auto_mixed_precision(&self) -> Toggle[src]

Returns the enum value of auto_mixed_precision, or the default if the field is set to an invalid enum value.

pub fn set_auto_mixed_precision(&mut self, value: Toggle)[src]

Sets auto_mixed_precision to the provided enum value.

Trait Implementations

impl Clone for RewriterConfig[src]

impl Debug for RewriterConfig[src]

impl Default for RewriterConfig[src]

impl Message for RewriterConfig[src]

impl PartialEq<RewriterConfig> for RewriterConfig[src]

impl StructuralPartialEq for RewriterConfig[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.