Missed TensorFlow Dev Summit? Check out the video playlist. Watch recordings

Module: tf

TensorFlow 2 version

TensorFlow root package

Modules

app module: Generic entry point script.

audio module: Public API for tf.audio namespace.

autograph module: Conversion of plain Python into TensorFlow graph code.

bitwise module: Operations for manipulating the binary representations of integers.

compat module: Functions for Python 2 vs. 3 compatibility.

config module: Public API for tf.config namespace.

contrib module: Contrib module containing volatile or experimental code.

data module: tf.data.Dataset API for input pipelines.

debugging module: Public API for tf.debugging namespace.

distribute module: Library for running a computation across multiple devices.

distributions module: Core module for TensorFlow distribution objects and helpers.

dtypes module: Public API for tf.dtypes namespace.

errors module: Exception types for TensorFlow errors.

estimator module: Estimator: High level tools for working with models.

experimental module: Public API for tf.experimental namespace.

feature_column module: Public API for tf.feature_column namespace.

gfile module: Import router for file_io.

graph_util module: Helpers to manipulate a tensor graph in python.

image module: Image processing and decoding ops.

initializers module: Public API for tf.initializers namespace.

io module: Public API for tf.io namespace.

keras module: Implementation of the Keras API meant to be a high-level API for TensorFlow.

layers module: Public API for tf.layers namespace.

linalg module: Operations for linear algebra.

lite module: Public API for tf.lite namespace.

logging module: Logging and Summary Operations.

lookup module: Public API for tf.lookup namespace.

losses module: Loss operations for use in neural networks.

manip module: Operators for manipulating tensors.

math module: Math Operations.

metrics module: Evaluation-related metrics.

nest module: Public API for tf.nest namespace.

nn module: Wrappers for primitive Neural Net (NN) Operations.

profiler module: Public API for tf.profiler namespace.

python_io module: Python functions for directly manipulating TFRecord-formatted files.

quantization module: Public API for tf.quantization namespace.

queue module: Public API for tf.queue namespace.

ragged module: Ragged Tensors.

random module: Public API for tf.random namespace.

raw_ops module: Note: tf.raw_ops provides direct/low level access to all TensorFlow ops. See the RFC

resource_loader module: Resource management library.

saved_model module: Public API for tf.saved_model namespace.

sets module: Tensorflow set operations.

signal module: Signal processing operations.

sparse module: Sparse Tensor Representation.

spectral module: Public API for tf.spectral namespace.

strings module: Operations for working with string Tensors.

summary module: Operations for writing summary data, for use in analysis and visualization.

sysconfig module: System configuration library.

test module: Testing.

tpu module: Ops related to Tensor Processing Units.

train module: Support for training models.

user_ops module: Public API for tf.user_ops namespace.

version module: Public API for tf.version namespace.

xla module: Public API for tf.xla namespace.

Classes

class AggregationMethod: A class listing aggregation methods used to combine gradients.

class AttrValue: A ProtocolMessage

class ConditionalAccumulator: A conditional accumulator for aggregating gradients.

class ConditionalAccumulatorBase: A conditional accumulator for aggregating gradients.

class ConfigProto: A ProtocolMessage

class CriticalSection: Critical section.

class DType: Represents the type of the elements in a Tensor.

class DeviceSpec: Represents a (possibly partial) specification for a TensorFlow device.

class Dimension: Represents the value of one dimension in a TensorShape.

class Event: A ProtocolMessage

class FIFOQueue: A queue implementation that dequeues elements in first-in first-out order.

class FixedLenFeature: Configuration for parsing a fixed-length input feature.

class FixedLenSequenceFeature: Configuration for parsing a variable-length input feature into a Tensor.

class FixedLengthRecordReader: A Reader that outputs fixed-length records from a file.

class GPUOptions: A ProtocolMessage

class GradientTape: Record operations for automatic differentiation.

class Graph: A TensorFlow computation, represented as a dataflow graph.

class GraphDef: A ProtocolMessage

class GraphKeys: Standard names to use for graph collections.

class GraphOptions: A ProtocolMessage

class HistogramProto: A ProtocolMessage

class IdentityReader: A Reader that outputs the queued work as both the key and value.

class IndexedSlices: A sparse representation of a set of tensor slices at given indices.

class IndexedSlicesSpec: Type specification for a tf.IndexedSlices.

class InteractiveSession: A TensorFlow Session for use in interactive contexts, such as a shell.

class LMDBReader: A Reader that outputs the records from a LMDB file.

class LogMessage: A ProtocolMessage

class MetaGraphDef: A ProtocolMessage

class Module: Base neural network module class.

class NameAttrList: A ProtocolMessage

class NodeDef: A ProtocolMessage

class OpError: A generic error that is raised when TensorFlow execution fails.

class Operation: Represents a graph node that performs computation on tensors.

class OptimizerOptions: A ProtocolMessage

class OptionalSpec: Represents an optional potentially containing a structured value.

class PaddingFIFOQueue: A FIFOQueue that supports batching variable-sized tensors by padding.

class PriorityQueue: A queue implementation that dequeues elements in prioritized order.

class QueueBase: Base class for queue implementations.

class RaggedTensor: Represents a ragged tensor.

class RaggedTensorSpec: Type specification for a tf.RaggedTensor.

class RandomShuffleQueue: A queue implementation that dequeues elements in a random order.

class ReaderBase: Base class for different Reader types, that produce a record every step.

class RegisterGradient: A decorator for registering the gradient function for an op type.

class RunMetadata: A ProtocolMessage

class RunOptions: A ProtocolMessage

class Session: A class for running TensorFlow operations.

class SessionLog: A ProtocolMessage

class SparseConditionalAccumulator: A conditional accumulator for aggregating sparse gradients.

class SparseFeature: Configuration for parsing a sparse input feature from an Example.

class SparseTensor: Represents a sparse tensor.

class SparseTensorSpec: Type specification for a tf.SparseTensor.

class SparseTensorValue: SparseTensorValue(indices, values, dense_shape)

class Summary: A ProtocolMessage

class SummaryMetadata: A ProtocolMessage

class TFRecordReader: A Reader that outputs the records from a TFRecords file.

class Tensor: Represents one of the outputs of an Operation.

class TensorArray: Class wrapping dynamic-sized, per-time-step, write-once Tensor arrays.

class TensorArraySpec: Type specification for a tf.TensorArray.

class TensorInfo: A ProtocolMessage

class TensorShape: Represents the shape of a Tensor.

class TensorSpec: Describes a tf.Tensor.

class TextLineReader: A Reader that outputs the lines of a file delimited by newlines.

class TypeSpec: Specifies a TensorFlow value type.

class UnconnectedGradients: Controls how gradient computation behaves when y does not depend on x.

class VarLenFeature: Configuration for parsing a variable-length input feature.

class Variable: See the Variables Guide.

class VariableAggregation: Indicates how a distributed variable will be aggregated.

class VariableScope: Variable scope object to carry defaults to provide to get_variable.

class VariableSynchronization: Indicates when a distributed variable will be synced.

class WholeFileReader: A Reader that outputs the entire contents of a file as a value.

class constant_initializer: Initializer that generates tensors with constant values.

class glorot_normal_initializer: The Glorot normal initializer, also called Xavier normal initializer.

class glorot_uniform_initializer: The Glorot uniform initializer, also called Xavier uniform initializer.

class name_scope: A context manager for use when defining a Python op.

class ones_initializer: Initializer that generates tensors initialized to 1.

class orthogonal_initializer: Initializer that generates an orthogonal matrix.

class random_normal_initializer: Initializer that generates tensors with a normal distribution.

class random_uniform_initializer: Initializer that generates tensors with a uniform distribution.

class truncated_normal_initializer: Initializer that generates a truncated normal distribution.

class uniform_unit_scaling_initializer: Initializer that generates tensors without scaling variance.

class variable_scope: A context manager for defining ops that creates variables (layers).

class variance_scaling_initializer: Initializer capable of adapting its scale to the shape of weights tensors.

class zeros_initializer: Initializer that generates tensors initialized to 0.

Functions

Assert(...): Asserts that the given condition is true.

NoGradient(...): Specifies that ops of type op_type is not differentiable.

NotDifferentiable(...): Specifies that ops of type op_type is not differentiable.

Print(...): Prints a list of tensors. (deprecated)

abs(...): Computes the absolute value of a tensor.

accumulate_n(...): Returns the element-wise sum of a list of tensors.

acos(...): Computes acos of x element-wise.

acosh(...): Computes inverse hyperbolic cosine of x element-wise.

add(...): Returns x + y element-wise.

add_check_numerics_ops(...): Connect a tf.debugging.check_numerics to every floating point tensor.

add_n(...): Adds all input tensors element-wise.

add_to_collection(...): Wrapper for Graph.add_to_collection() using the default graph.

add_to_collections(...): Wrapper for Graph.add_to_collections() using the default graph.

all_variables(...): Use tf.compat.v1.global_variables instead. (deprecated)

angle(...): Returns the element-wise argument of a complex (or real) tensor.

arg_max(...): Returns the index with the largest value across dimensions of a tensor.

arg_min(...): Returns the index with the smallest value across dimensions of a tensor.

argmax(...): Returns the index with the largest value across axes of a tensor. (deprecated arguments)

argmin(...): Returns the index with the smallest value across axes of a tensor. (deprecated arguments)

argsort(...): Returns the indices of a tensor that give its sorted order along an axis.

as_dtype(...): Converts the given type_value to a DType.

as_string(...): Converts each entry in the given tensor to strings.

asin(...): Computes the trignometric inverse sine of x element-wise.

asinh(...): Computes inverse hyperbolic sine of x element-wise.

assert_equal(...): Assert the condition x == y holds element-wise.

assert_greater(...): Assert the condition x > y holds element-wise.

assert_greater_equal(...): Assert the condition x >= y holds element-wise.

assert_integer(...): Assert that x is of integer dtype.

assert_less(...): Assert the condition x < y holds element-wise.

assert_less_equal(...): Assert the condition x <= y holds element-wise.

assert_near(...): Assert the condition x and y are close element-wise.

assert_negative(...): Assert the condition x < 0 holds element-wise.

assert_non_negative(...): Assert the condition x >= 0 holds element-wise.

assert_non_positive(...): Assert the condition x <= 0 holds element-wise.

assert_none_equal(...): Assert the condition x != y holds element-wise.

assert_positive(...): Assert the condition x > 0 holds element-wise.

assert_proper_iterable(...): Static assert that values is a "proper" iterable.

assert_rank(...): Assert x has rank equal to rank.

assert_rank_at_least(...): Assert x has rank equal to rank or higher.

assert_rank_in(...): Assert x has rank in ranks.

assert_same_float_dtype(...): Validate and return float type based on tensors and dtype.

assert_scalar(...): Asserts that the given tensor is a scalar (i.e. zero-dimensional).

assert_type(...): Statically asserts that the given Tensor is of the specified type.

assert_variables_initialized(...): Returns an Op to check if variables are initialized.

assign(...): Update ref by assigning value to it.

assign_add(...): Update ref by adding value to it.

assign_sub(...): Update ref by subtracting value from it.

atan(...): Computes the trignometric inverse tangent of x element-wise.

atan2(...): Computes arctangent of y/x element-wise, respecting signs of the arguments.

atanh(...): Computes inverse hyperbolic tangent of x element-wise.

batch_gather(...): Gather slices from params according to indices with leading batch dims. (deprecated)

batch_scatter_update(...): Generalization of tf.compat.v1.scatter_update to axis different than 0. (deprecated)

batch_to_space(...): BatchToSpace for 4-D tensors of type T.

batch_to_space_nd(...): BatchToSpace for N-D tensors of type T.

betainc(...): Compute the regularized incomplete beta integral \(I_x(a, b)\).

bincount(...): Counts the number of occurrences of each value in an integer array.

bitcast(...): Bitcasts a tensor from one type to another without copying data.

boolean_mask(...): Apply boolean mask to tensor.

broadcast_dynamic_shape(...): Computes the shape of a broadcast given symbolic shapes.

broadcast_static_shape(...): Computes the shape of a broadcast given known shapes.

broadcast_to(...): Broadcast an array for a compatible shape.

case(...): Create a case operation.

cast(...): Casts a tensor to a new type.

ceil(...): Returns element-wise smallest integer not less than x.

check_numerics(...): Checks a tensor for NaN and Inf values.

cholesky(...): Computes the Cholesky decomposition of one or more square matrices.

cholesky_solve(...): Solves systems of linear eqns A X = RHS, given Cholesky factorizations.

clip_by_average_norm(...): Clips tensor values to a maximum average L2-norm. (deprecated)

clip_by_global_norm(...): Clips values of multiple tensors by the ratio of the sum of their norms.

clip_by_norm(...): Clips tensor values to a maximum L2-norm.

clip_by_value(...): Clips tensor values to a specified min and max.

colocate_with(...): DEPRECATED FUNCTION

complex(...): Converts two real numbers to a complex number.

concat(...): Concatenates tensors along one dimension.

cond(...): Return true_fn() if the predicate pred is true else false_fn(). (deprecated arguments)

confusion_matrix(...): Computes the confusion matrix from predictions and labels.

conj(...): Returns the complex conjugate of a complex number.

constant(...): Creates a constant tensor.

container(...): Wrapper for Graph.container() using the default graph.

control_dependencies(...): Wrapper for Graph.control_dependencies() using the default graph.

control_flow_v2_enabled(...): Returns True if v2 control flow is enabled.

convert_to_tensor(...): Converts the given value to a Tensor.

convert_to_tensor_or_indexed_slices(...): Converts the given object to a Tensor or an IndexedSlices.

convert_to_tensor_or_sparse_tensor(...): Converts value to a SparseTensor or Tensor.

cos(...): Computes cos of x element-wise.

cosh(...): Computes hyperbolic cosine of x element-wise.

count_nonzero(...): Computes number of nonzero elements across dimensions of a tensor. (deprecated arguments) (deprecated arguments)

count_up_to(...): Increments 'ref' until it reaches 'limit'. (deprecated)

create_partitioned_variables(...): Create a list of partitioned variables according to the given slicing. (deprecated)

cross(...): Compute the pairwise cross product.

cumprod(...): Compute the cumulative product of the tensor x along axis.

cumsum(...): Compute the cumulative sum of the tensor x along axis.

custom_gradient(...): Decorator to define a function with a custom gradient.

decode_base64(...): Decode web-safe base64-encoded strings.

decode_compressed(...): Decompress strings.

decode_csv(...): Convert CSV records to tensors. Each column maps to one tensor.

decode_json_example(...): Convert JSON-encoded Example records to binary protocol buffer strings.

decode_raw(...): Convert raw byte strings into tensors. (deprecated arguments)

delete_session_tensor(...): Delete the tensor for the given tensor handle.

depth_to_space(...): DepthToSpace for tensors of type T.

dequantize(...): Dequantize the 'input' tensor into a float Tensor.

deserialize_many_sparse(...): Deserialize and concatenate SparseTensors from a serialized minibatch.

device(...): Wrapper for Graph.device() using the default graph.

diag(...): Returns a diagonal tensor with a given diagonal values.

diag_part(...): Returns the diagonal part of the tensor.

digamma(...): Computes Psi, the derivative of Lgamma (the log of the absolute value of

dimension_at_index(...): Compatibility utility required to allow for both V1 and V2 behavior in TF.

dimension_value(...): Compatibility utility required to allow for both V1 and V2 behavior in TF.

disable_control_flow_v2(...): Opts out of control flow v2.

disable_eager_execution(...): Disables eager execution.

disable_resource_variables(...): Opts out of resource variables. (deprecated)

disable_tensor_equality(...): Compare Tensors by their id and be hashable.

disable_v2_behavior(...): Disables TensorFlow 2.x behaviors.

disable_v2_tensorshape(...): Disables the V2 TensorShape behavior and reverts to V1 behavior.

div(...): Divides x / y elementwise (using Python 2 division operator semantics). (deprecated)

div_no_nan(...): Computes an unsafe divide which returns 0 if the y is zero.

divide(...): Computes Python style division of x by y.

dynamic_partition(...): Partitions data into num_partitions tensors using indices from partitions.

dynamic_stitch(...): Interleave the values from the data tensors into a single tensor.

edit_distance(...): Computes the Levenshtein distance between sequences.

einsum(...): Tensor contraction over specified indices and outer product.

enable_control_flow_v2(...): Use control flow v2.

enable_eager_execution(...): Enables eager execution for the lifetime of this program.

enable_resource_variables(...): Creates resource variables by default.

enable_tensor_equality(...): Compare Tensors with element-wise comparison and thus be unhashable.

enable_v2_behavior(...): Enables TensorFlow 2.x behaviors.

enable_v2_tensorshape(...): In TensorFlow 2.0, iterating over a TensorShape instance returns values.

encode_base64(...): Encode strings into web-safe base64 format.

ensure_shape(...): Updates the shape of a tensor and checks at runtime that the shape holds.

equal(...): Returns the truth value of (x == y) element-wise.

erf(...): Computes the Gauss error function of x element-wise.

erfc(...): Computes the complementary error function of x element-wise.

executing_eagerly(...): Returns True if the current thread has eager execution enabled.

exp(...): Computes exponential of x element-wise. \(y = e^x\).

expand_dims(...): Inserts a dimension of 1 into a tensor's shape. (deprecated arguments)

expm1(...): Computes exp(x) - 1 element-wise.

extract_image_patches(...): Extract patches from images and put them in the "depth" output dimension.

extract_volume_patches(...): Extract patches from input and put them in the "depth" output dimension. 3D extension of extract_image_patches.

eye(...): Construct an identity matrix, or a batch of matrices.

fake_quant_with_min_max_args(...): Fake-quantize the 'inputs' tensor, type float to 'outputs' tensor of same type.

fake_quant_with_min_max_args_gradient(...): Compute gradients for a FakeQuantWithMinMaxArgs operation.

fake_quant_with_min_max_vars(...): Fake-quantize the 'inputs' tensor of type float via global float scalars min

fake_quant_with_min_max_vars_gradient(...): Compute gradients for a FakeQuantWithMinMaxVars operation.

fake_quant_with_min_max_vars_per_channel(...): Fake-quantize the 'inputs' tensor of type float and one of the shapes: [d],

fake_quant_with_min_max_vars_per_channel_gradient(...): Compute gradients for a FakeQuantWithMinMaxVarsPerChannel operation.

fft(...): Fast Fourier transform.

fft2d(...): 2D fast Fourier transform.

fft3d(...): 3D fast Fourier transform.

fill(...): Creates a tensor filled with a scalar value.

fingerprint(...): Generates fingerprint values.

fixed_size_partitioner(...): Partitioner to specify a fixed number of shards along given axis.

floor(...): Returns element-wise largest integer not greater than x.

floor_div(...): Returns x // y element-wise.

floordiv(...): Divides x / y elementwise, rounding toward the most negative integer.

floormod(...): Returns element-wise remainder of division. When x < 0 xor y < 0 is

foldl(...): foldl on the list of tensors unpacked from elems on dimension 0.

foldr(...): foldr on the list of tensors unpacked from elems on dimension 0.

function(...): Creates a callable TensorFlow graph from a Python function.

gather(...): Gather slices from params axis axis according to indices.

gather_nd(...): Gather slices from params into a Tensor with shape specified by indices.

get_collection(...): Wrapper for Graph.get_collection() using the default graph.

get_collection_ref(...): Wrapper for Graph.get_collection_ref() using the default graph.

get_default_graph(...): Returns the default graph for the current thread.

get_default_session(...): Returns the default session for the current thread.

get_local_variable(...): Gets an existing local variable or creates a new one.

get_logger(...): Return TF logger instance.

get_seed(...): Returns the local seeds an operation should use given an op-specific seed.

get_session_handle(...): Return the handle of data.

get_session_tensor(...): Get the tensor of type dtype by feeding a tensor handle.

get_static_value(...): Returns the constant value of the given tensor, if efficiently calculable.

get_variable(...): Gets an existing variable with these parameters or create a new one.

get_variable_scope(...): Returns the current variable scope.

global_norm(...): Computes the global norm of m