Save the date! Google I/O returns May 18-20 Register now

Module: tf.compat.v1

TensorFlow 2 version View source on GitHub

Bring in all of the public TensorFlow interface into this module.


app module: Generic entry point script.

audio module: Public API for 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.

data module: 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 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: Public API for tf.raw_ops namespace.

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.


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.


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.