LostTech.TensorFlow : API Documentation

Type framework

Namespace tensorflow.contrib.framework

Methods

Properties

Public static methods

Tensor assert_scalar_int(IGraphNodeBase tensor, string name)

Tensor assert_scalar_int(int tensor, string name)

object assert_scalar_int_dyn(object tensor, object name)

object experimental(object func)

object experimental_dyn(object func)

object fuse_op(object graph_def, object input_nodes, object output_nodes, IEnumerable<int> output_dtypes, bool output_quantized, string op_name, string op_type)

object fuse_op(object graph_def, IEnumerable<string> input_nodes, IEnumerable<string> output_nodes, IEnumerable<int> output_dtypes, bool output_quantized, string op_name, string op_type)

object fuse_op(object graph_def, IEnumerable<string> input_nodes, object output_nodes, IEnumerable<int> output_dtypes, bool output_quantized, string op_name, string op_type)

object fuse_op(object graph_def, object input_nodes, IEnumerable<string> output_nodes, IEnumerable<int> output_dtypes, bool output_quantized, string op_name, string op_type)

object fuse_op_dyn(object graph_def, object input_nodes, object output_nodes, object output_dtypes, object output_quantized, object op_name, object op_type)

Graph get_graph_from_inputs(IEnumerable<object> op_input_list, Graph graph)

object get_graph_from_inputs_dyn(object op_input_list, object graph)

IList<object> get_placeholders(object graph)

object get_placeholders_dyn(object graph)

void init_from_checkpoint(string checkpoint_dir, IDictionary<string, string> assignment_map)

Replaces tf.Variable initializers so they load from a checkpoint file.

Values are not loaded immediately, but when the initializer is run (typically by running a `tf.compat.v1.global_variables_initializer` op).

Note: This overrides default initialization ops of specified variables and redefines dtype.

Assignment map supports following syntax:

* `'checkpoint_scope_name/': 'scope_name/'` - will load all variables in current `scope_name` from `checkpoint_scope_name` with matching tensor names. * `'checkpoint_scope_name/some_other_variable': 'scope_name/variable_name'` - will initialize `scope_name/variable_name` variable from `checkpoint_scope_name/some_other_variable`. * `'scope_variable_name': variable` - will initialize given tf.Variable object with tensor 'scope_variable_name' from the checkpoint. * `'scope_variable_name': list(variable)` - will initialize list of partitioned variables with tensor 'scope_variable_name' from the checkpoint. * `'/': 'scope_name/'` - will load all variables in current `scope_name` from checkpoint's root (e.g. no scope).

Supports loading into partitioned variables, which are represented as `'/part_'`.

Example:
Parameters
string checkpoint_dir
IDictionary<string, string> assignment_map
Dict, where keys are names of the variables in the checkpoint and values are current variables or names of current variables (in default graph).
Show Example
# Say, '/tmp/model.ckpt' has the following tensors:
            #  -- name='old_scope_1/var1', shape=[20, 2]
            #  -- name='old_scope_1/var2', shape=[50, 4]
            #  -- name='old_scope_2/var3', shape=[100, 100] 

# Create new model's variables with tf.compat.v1.variable_scope('new_scope_1'): var1 = tf.compat.v1.get_variable('var1', shape=[20, 2], initializer=tf.compat.v1.zeros_initializer()) with tf.compat.v1.variable_scope('new_scope_2'): var2 = tf.compat.v1.get_variable('var2', shape=[50, 4], initializer=tf.compat.v1.zeros_initializer()) # Partition into 5 variables along the first axis. var3 = tf.compat.v1.get_variable(name='var3', shape=[100, 100], initializer=tf.compat.v1.zeros_initializer(), partitioner=lambda shape, dtype: [5, 1])

# Initialize all variables in `new_scope_1` from `old_scope_1`. init_from_checkpoint('/tmp/model.ckpt', {'old_scope_1/': 'new_scope_1'})

# Use names to specify which variables to initialize from checkpoint. init_from_checkpoint('/tmp/model.ckpt', {'old_scope_1/var1': 'new_scope_1/var1', 'old_scope_1/var2': 'new_scope_2/var2'})

# Or use tf.Variable objects to identify what to initialize. init_from_checkpoint('/tmp/model.ckpt', {'old_scope_1/var1': var1, 'old_scope_1/var2': var2})

# Initialize partitioned variables using variable's name init_from_checkpoint('/tmp/model.ckpt', {'old_scope_2/var3': 'new_scope_2/var3'})

# Or specify the list of tf.Variable objects. init_from_checkpoint('/tmp/model.ckpt', {'old_scope_2/var3': var3._get_variable_list()})

object init_from_checkpoint_dyn(object checkpoint_dir, object assignment_map)

Replaces tf.Variable initializers so they load from a checkpoint file.

Values are not loaded immediately, but when the initializer is run (typically by running a `tf.compat.v1.global_variables_initializer` op).

Note: This overrides default initialization ops of specified variables and redefines dtype.

Assignment map supports following syntax:

* `'checkpoint_scope_name/': 'scope_name/'` - will load all variables in current `scope_name` from `checkpoint_scope_name` with matching tensor names. * `'checkpoint_scope_name/some_other_variable': 'scope_name/variable_name'` - will initialize `scope_name/variable_name` variable from `checkpoint_scope_name/some_other_variable`. * `'scope_variable_name': variable` - will initialize given tf.Variable object with tensor 'scope_variable_name' from the checkpoint. * `'scope_variable_name': list(variable)` - will initialize list of partitioned variables with tensor 'scope_variable_name' from the checkpoint. * `'/': 'scope_name/'` - will load all variables in current `scope_name` from checkpoint's root (e.g. no scope).

Supports loading into partitioned variables, which are represented as `'/part_'`.

Example:
Parameters
object checkpoint_dir
object assignment_map
Dict, where keys are names of the variables in the checkpoint and values are current variables or names of current variables (in default graph).
Show Example
# Say, '/tmp/model.ckpt' has the following tensors:
            #  -- name='old_scope_1/var1', shape=[20, 2]
            #  -- name='old_scope_1/var2', shape=[50, 4]
            #  -- name='old_scope_2/var3', shape=[100, 100] 

# Create new model's variables with tf.compat.v1.variable_scope('new_scope_1'): var1 = tf.compat.v1.get_variable('var1', shape=[20, 2], initializer=tf.compat.v1.zeros_initializer()) with tf.compat.v1.variable_scope('new_scope_2'): var2 = tf.compat.v1.get_variable('var2', shape=[50, 4], initializer=tf.compat.v1.zeros_initializer()) # Partition into 5 variables along the first axis. var3 = tf.compat.v1.get_variable(name='var3', shape=[100, 100], initializer=tf.compat.v1.zeros_initializer(), partitioner=lambda shape, dtype: [5, 1])

# Initialize all variables in `new_scope_1` from `old_scope_1`. init_from_checkpoint('/tmp/model.ckpt', {'old_scope_1/': 'new_scope_1'})

# Use names to specify which variables to initialize from checkpoint. init_from_checkpoint('/tmp/model.ckpt', {'old_scope_1/var1': 'new_scope_1/var1', 'old_scope_1/var2': 'new_scope_2/var2'})

# Or use tf.Variable objects to identify what to initialize. init_from_checkpoint('/tmp/model.ckpt', {'old_scope_1/var1': var1, 'old_scope_1/var2': var2})

# Initialize partitioned variables using variable's name init_from_checkpoint('/tmp/model.ckpt', {'old_scope_2/var3': 'new_scope_2/var3'})

# Or specify the list of tf.Variable objects. init_from_checkpoint('/tmp/model.ckpt', {'old_scope_2/var3': var3._get_variable_list()})

IList<ValueTuple<object, object>> list_variables(string checkpoint_dir)

Returns list of all variables in the checkpoint.
Returns
IList<ValueTuple<object, object>>
List of tuples `(name, shape)`.

object list_variables_dyn(object checkpoint_dir)

Returns list of all variables in the checkpoint.
Returns
object
List of tuples `(name, shape)`.

CheckpointReader load_checkpoint(Byte[] filepattern)

Returns `CheckpointReader` for checkpoint found in `ckpt_dir_or_file`.

If `ckpt_dir_or_file` resolves to a directory with multiple checkpoints, reader for the latest checkpoint is returned.
Returns
CheckpointReader
`CheckpointReader` object.

CheckpointReader load_checkpoint(string filepattern)

Returns `CheckpointReader` for checkpoint found in `ckpt_dir_or_file`.

If `ckpt_dir_or_file` resolves to a directory with multiple checkpoints, reader for the latest checkpoint is returned.
Returns
CheckpointReader
`CheckpointReader` object.

object load_checkpoint_dyn(object filepattern)

Returns `CheckpointReader` for checkpoint found in `ckpt_dir_or_file`.

If `ckpt_dir_or_file` resolves to a directory with multiple checkpoints, reader for the latest checkpoint is returned.
Returns
object
`CheckpointReader` object.

object load_linear_multiclass_bias_initializer(object ckpt_path, object bias_tensor_name, object new_class_vocab_size, object old_class_vocab_file, object new_class_vocab_file, int num_class_oov_buckets, object initializer, int max_rows_in_memory)

object load_linear_multiclass_bias_initializer_dyn(object ckpt_path, object bias_tensor_name, object new_class_vocab_size, object old_class_vocab_file, object new_class_vocab_file, ImplicitContainer<T> num_class_oov_buckets, object initializer, ImplicitContainer<T> max_rows_in_memory)

object load_variable(Byte[] checkpoint_dir, string name)

Returns the tensor value of the given variable in the checkpoint.
Parameters
Byte[] checkpoint_dir
string name
Name of the variable to return.
Returns
object
A numpy `ndarray` with a copy of the value of this variable.

object load_variable(string checkpoint_dir, string name)

Returns the tensor value of the given variable in the checkpoint.
Parameters
string checkpoint_dir
string name
Name of the variable to return.
Returns
object
A numpy `ndarray` with a copy of the value of this variable.

object load_variable_dyn(object checkpoint_dir, object name)

Returns the tensor value of the given variable in the checkpoint.
Parameters
object checkpoint_dir
object name
Name of the variable to return.
Returns
object
A numpy `ndarray` with a copy of the value of this variable.

object load_variable_slot_initializer(object ckpt_path, object old_tensor_name, object primary_partition_info, object new_row_vocab_size, object new_col_vocab_size, object old_row_vocab_file, object new_row_vocab_file, object old_col_vocab_file, object new_col_vocab_file, int num_row_oov_buckets, int num_col_oov_buckets, object initializer, int max_rows_in_memory)

object load_variable_slot_initializer_dyn(object ckpt_path, object old_tensor_name, object primary_partition_info, object new_row_vocab_size, object new_col_vocab_size, object old_row_vocab_file, object new_row_vocab_file, object old_col_vocab_file, object new_col_vocab_file, ImplicitContainer<T> num_row_oov_buckets, ImplicitContainer<T> num_col_oov_buckets, object initializer, ImplicitContainer<T> max_rows_in_memory)

object py_func(object func, ImplicitContainer<T> args, IDictionary<object, object> kwargs, object output_types, object output_shapes, bool stateful, string name)

object py_func(object func, ImplicitContainer<T> args, IDictionary<object, object> kwargs, object output_types, IEnumerable<object> output_shapes, bool stateful, string name)

object py_func(object func, ImplicitContainer<T> args, IDictionary<object, object> kwargs, object output_types, TensorShape output_shapes, bool stateful, string name)

object py_func(object func, ImplicitContainer<T> args, IDictionary<object, object> kwargs, object output_types, PythonClassContainer output_shapes, bool stateful, string name)

object py_func_dyn(object func, ImplicitContainer<T> args, object kwargs, object output_types, object output_shapes, ImplicitContainer<T> stateful, object name)

Tensor reduce_sum_n(IEnumerable<IGraphNodeBase> tensors, string name)

object reduce_sum_n_dyn(object tensors, object name)

ValueTuple<object, object> remove_squeezable_dimensions(object predictions, object labels, string name)

ValueTuple<object, object> remove_squeezable_dimensions(object predictions, IGraphNodeBase labels, string name)

ValueTuple<object, object> remove_squeezable_dimensions(object predictions, ValueTuple<IEnumerable<object>, object> labels, string name)

ValueTuple<object, object> remove_squeezable_dimensions(IGraphNodeBase predictions, object labels, string name)

ValueTuple<object, object> remove_squeezable_dimensions(IGraphNodeBase predictions, IGraphNodeBase labels, string name)

ValueTuple<object, object> remove_squeezable_dimensions(IEnumerable<object> predictions, IEnumerable<object> labels, string name)

ValueTuple<object, object> remove_squeezable_dimensions(IEnumerable<object> predictions, ValueTuple<IEnumerable<object>, object> labels, string name)

ValueTuple<object, object> remove_squeezable_dimensions(IEnumerable<object> predictions, object labels, string name)

ValueTuple<object, object> remove_squeezable_dimensions(ValueTuple<IEnumerable<object>, object> predictions, IEnumerable<object> labels, string name)

ValueTuple<object, object> remove_squeezable_dimensions(ValueTuple<IEnumerable<object>, object> predictions, ValueTuple<IEnumerable<object>, object> labels, string name)

ValueTuple<object, object> remove_squeezable_dimensions(ValueTuple<IEnumerable<object>, object> predictions, IGraphNodeBase labels, string name)

ValueTuple<object, object> remove_squeezable_dimensions(ValueTuple<IEnumerable<object>, object> predictions, object labels, string name)

ValueTuple<object, object> remove_squeezable_dimensions(object predictions, IEnumerable<object> labels, string name)

ValueTuple<object, object> remove_squeezable_dimensions(IEnumerable<object> predictions, IGraphNodeBase labels, string name)

ValueTuple<object, object> remove_squeezable_dimensions(IGraphNodeBase predictions, IEnumerable<object> labels, string name)

ValueTuple<object, object> remove_squeezable_dimensions(IGraphNodeBase predictions, ValueTuple<IEnumerable<object>, object> labels, string name)

object remove_squeezable_dimensions_dyn(object predictions, object labels, object name)

object with_same_shape(IGraphNodeBase expected_tensor, IGraphNodeBase tensor)

object with_same_shape_dyn(object expected_tensor, object tensor)

object with_shape(ValueTuple<IEnumerable<object>, object> expected_shape, IGraphNodeBase tensor)

object with_shape(IEnumerable<int> expected_shape, IGraphNodeBase tensor)

object with_shape(ndarray expected_shape, IGraphNodeBase tensor)

object with_shape(TensorShape expected_shape, IGraphNodeBase tensor)

object with_shape(IGraphNodeBase expected_shape, IGraphNodeBase tensor)

object with_shape_dyn(object expected_shape, object tensor)

Public properties

PythonFunctionContainer assert_scalar_int_fn get;

PythonFunctionContainer experimental_fn get;

PythonFunctionContainer fuse_op_fn get;

PythonFunctionContainer get_graph_from_inputs_fn get;

PythonFunctionContainer get_name_scope_fn get;

PythonFunctionContainer get_placeholders_fn get;

PythonFunctionContainer init_from_checkpoint_fn get;

PythonFunctionContainer list_variables_fn get;

PythonFunctionContainer load_checkpoint_fn get;

PythonFunctionContainer load_linear_multiclass_bias_initializer_fn get;

PythonFunctionContainer load_variable_fn get;

PythonFunctionContainer load_variable_slot_initializer_fn get;

PythonFunctionContainer py_func_fn get;

PythonFunctionContainer reduce_sum_n_fn get;

PythonFunctionContainer remove_squeezable_dimensions_fn get;

PythonFunctionContainer with_same_shape_fn get;

PythonFunctionContainer with_shape_fn get;