本文档为TensorFlow参考文档,本转载已得到TensorFlow中文社区授权。
Classes and functions for building TensorFlow graphs.
A TensorFlow computation, represented as a dataflow graph.
A Graph contains a set of Operation objects, which represent units of computation; and Tensorobjects, which represent the units of data that flow between operations.
A default Graph is always registered, and accessible by calling tf.get_default_graph(). To add an operation to the default graph, simply call one of the functions that defines a new Operation:
c = tf.constant(4.0) assert c.graph is tf.get_default_graph()Another typical usage involves the Graph.as_default() context manager, which overrides the current default graph for the lifetime of the context:
g = tf.Graph() with g.as_default(): # Define operations and tensors in `g`. c = tf.constant(30.0) assert c.graph is gImportant note: This class is not thread-safe for graph construction. All operations should be created from a single thread, or external synchronization must be provided. Unless otherwise specified, all methods are not thread-safe.
Creates a new, empty Graph.
Returns a context manager that makes this Graph the default graph.
This method should be used if you want to create multiple graphs in the same process. For convenience, a global default graph is provided, and all ops will be added to this graph if you do not create a new graph explicitly. Use this method the with keyword to specify that ops created within the scope of a block should be added to this graph.
The default graph is a property of the current thread. If you create a new thread, and wish to use the default graph in that thread, you must explicitly add a with g.as_default(): in that thread's function.
The following code examples are equivalent:
# 1. Using Graph.as_default(): g = tf.Graph() with g.as_default(): c = tf.constant(5.0) assert c.graph is g # 2. Constructing and making default: with tf.Graph().as_default() as g: c = tf.constant(5.0) assert c.graph is gA context manager for using this graph as the default graph.
Returns a serialized GraphDef representation of this graph.
The serialized GraphDef can be imported into another Graph (using import_graph_def()) or used with the C++ Session API.
This method is thread-safe.
A GraphDef protocol buffer.
Finalizes this graph, making it read-only.
After calling g.finalize(), no new operations can be added to g. This method is used to ensure that no operations are added to a graph when it is shared between multiple threads, for example when using a QueueRunner.
True if this graph has been finalized.
Returns a context manager that specifies control dependencies.
Use with the with keyword to specify that all operations constructed within the context should have control dependencies on control_inputs. For example:
with g.control_dependencies([a, b, c]): # `d` and `e` will only run after `a`, `b`, and `c` have executed. d = ... e = ...Multiple calls to control_dependencies() can be nested, and in that case a new Operation will have control dependencies on the union of control_inputs from all active contexts.
with g.control_dependencies([a, b]): # Ops declared here run after `a` and `b`. with g.control_dependencies([c, d]): # Ops declared here run after `a`, `b`, `c`, and `d`.N.B. The control dependencies context applies only to ops that are constructed within the context. Merely using an op or tensor in the context does not add a control dependency. The following example illustrates this point:
# WRONG def my_func(pred, tensor): t = tf.matmul(tensor, tensor) with tf.control_dependencies([pred]): # The matmul op is created outside the context, so no control # dependency will be added. return t # RIGHT def my_func(pred, tensor): with tf.control_dependencies([pred]): # The matmul op is created in the context, so a control dependency # will be added. return tf.matmul(tensor, tensor)A context manager that specifies control dependencies for all operations constructed within the context.
Returns a context manager that specifies the default device to use.
The device_name_or_function argument may either be a device name string, a device function, or None:
If it is a device name string, all operations constructed in this context will be assigned to the device with that name.If it is a function, it will be treated as function from Operation objects to device name strings, and invoked each time a new Operation is created. The Operation will be assigned to the device with the returned name.If it is None, the default device will be cleared.For example:
with g.device('/gpu:0'): # All operations constructed in this context will be placed # on GPU 0. with g.device(None): # All operations constructed in this context will have no # assigned device. # Defines a function from `Operation` to device string. def matmul_on_gpu(n): if n.type == "MatMul": return "/gpu:0" else: return "/cpu:0" with g.device(matmul_on_gpu): # All operations of type "MatMul" constructed in this context # will be placed on GPU 0; all other operations will be placed # on CPU 0.A context manager that specifies the default device to use for newly created ops.
Returns a context manager that creates hierarchical names for operations.
A graph maintains a stack of name scopes. A with name_scope(...): statement pushes a new name onto the stack for the lifetime of the context.
The name argument will be interpreted as follows:
A string (not ending with '/') will create a new name scope, in which name is appended to the prefix of all operations created in the context. If name has been used before, it will be made unique by calling self.unique_name(name).A scope previously captured from a with g.name_scope(...) as scope: statement will be treated as an "absolute" name scope, which makes it possible to re-enter existing scopes.A value of None or the empty string will reset the current name scope to the top-level (empty) name scope.For example:
with tf.Graph().as_default() as g: c = tf.constant(5.0, name="c") assert c_1.name == "c" c_1 = tf.constant(6.0, name="c") assert c_1.name == "c_1" # Creates a scope called "nested" with g.name_scope("nested") as scope: nested_c = tf.constant(10.0, name="c") assert nested_c.name == "nested/c" # Creates a nested scope called "inner". with g.name_scope("inner"): nested_inner_c = tf.constant(20.0, name="c") assert nested_inner_c.name == "nested/inner/c" # Create a nested scope called "inner_1". with g.name_scope("inner"): nested_inner_1_c = tf.constant(30.0, name="c") assert nested_inner_1_c.name == "nested/inner_1/c" # Treats `scope` as an absolute name scope, and # switches to the "nested/" scope. with g.name_scope(scope): nested_d = tf.constant(40.0, name="d") assert nested_d.name == "nested/d" with g.name_scope(""): e = tf.constant(50.0, name="e") assert e.name == "e"The name of the scope itself can be captured by with g.name_scope(...) as scope:, which stores the name of the scope in the variable scope. This value can be used to name an operation that represents the overall result of executing the ops in a scope. For example:
inputs = tf.constant(...) with g.name_scope('my_layer') as scope: weights = tf.Variable(..., name="weights") biases = tf.Variable(..., name="biases") affine = tf.matmul(inputs, weights) + biases output = tf.nn.relu(affine, name=scope)A context manager that installs name as a new name scope.
A Graph instance supports an arbitrary number of "collections" that are identified by name. For convenience when building a large graph, collections can store groups of related objects: for example, the tf.Variable uses a collection (named tf.GraphKeys.VARIABLES) for all variables that are created during the construction of a graph. The caller may define additional collections by specifying a new name.
Stores value in the collection with the given name.
Returns a list of values in the collection with the given name.
The list of values in the collection with the given name, or an empty list if no value has been added to that collection. The list contains the values in the order under which they were collected.
Returns the object referred to by obj, as an Operation or Tensor.
This function validates that obj represents an element of this graph, and gives an informative error message if it is not.
This function is the canonical way to get/validate an object of one of the allowed types from an external argument reference in the Session API.
This method may be called concurrently from multiple threads.
The Tensor or Operation in the Graph corresponding to obj.
Returns the Operation with the given name.
This method may be called concurrently from multiple threads.
The Operation with the given name.
Returns the Tensor with the given name.
This method may be called concurrently from multiple threads.
The Tensor with the given name.
Return the list of operations in the graph.
You can modify the operations in place, but modifications to the list such as inserts/delete have no effect on the list of operations known to the graph.
This method may be called concurrently from multiple threads.
A list of Operations.
Returns the default device.
A string.
Return a unique Operation name for "name".
Note: You rarely need to call unique_name() directly. Most of the time you just need to create "with g.name_scope()" blocks to generate structured names.
unique_name is used to generate structured names, separated by "/", to help identify Operations when debugging a Graph. Operation names are displayed in error messages reported by the TensorFlow runtime, and in various visualization tools such as TensorBoard.
A string to be passed to create_op() that will be used to name the operation being created.
Returns a version number that increases as ops are added to the graph.
Creates an Operation in this graph.
This is a low-level interface for creating an Operation. Most programs will not call this method directly, and instead use the Python op constructors, such as tf.constant(), which add ops to the default graph.
An Operation object.
EXPERIMENTAL: A context manager for overriding gradient functions.
This context manager can be used to override the gradient function that will be used for ops within the scope of the context.
For example:
@tf.RegisterGradient("CustomSquare") def _custom_square_grad(op, inputs): # ... with tf.Graph().as_default() as g: c = tf.constant(5.0) s_1 = tf.square(c) # Uses the default gradient for tf.square. with g.gradient_override_map({"Square": "CustomSquare"}): s_2 = tf.square(s_2) # Uses _custom_square_grad to compute the # gradient of s_2.A context manager that sets the alternative op type to be used for one or more ops created in that context.
Represents a graph node that performs computation on tensors.
An Operation is a node in a TensorFlow Graph that takes zero or more Tensor objects as input, and produces zero or more Tensor objects as output. Objects of type Operation are created by calling a Python op constructor (such as tf.matmul()) or Graph.create_op().
For example c = tf.matmul(a, b) creates an Operation of type "MatMul" that takes tensors a and b as input, and produces c as output.
After the graph has been launched in a session, an Operation can be executed by passing it toSession.run(). op.run() is a shortcut for calling tf.get_default_session().run(op).
The full name of this operation.
The type of the op (e.g. "MatMul").
The list of Tensor objects representing the data inputs of this op.
The Operation objects on which this op has a control dependency.
Before this op is executed, TensorFlow will ensure that the operations in self.control_inputs have finished executing. This mechanism can be used to run ops sequentially for performance reasons, or to ensure that the side effects of an op are observed in the correct order.
A list of Operation objects.
The list of Tensor objects representing the outputs of this op.
The name of the device to which this op has been assigned, if any.
The string name of the device to which this op has been assigned, or None if it has not been assigned to a device.
The Graph that contains this operation.
Runs this operation in a Session.
Calling this method will execute all preceding operations that produce the inputs needed for this operation.
N.B. Before invoking Operation.run(), its graph must have been launched in a session, and either a default session must be available, or session must be specified explicitly.
Returns the value of the attr of this op with the given name.
The value of the attr, as a Python object.
Returns the call stack from when this operation was constructed.
Creates an Operation.
NOTE: This constructor validates the name of the Operation (passed as "node_def.name"). Valid Operation names match the following regular expression:
[A-Za-z0-9.][A-Za-z0-9_.-/]*
Returns a serialized NodeDef representation of this operation.
A NodeDef protocol buffer.
Returns the OpDef proto that represents the type of this op.
An OpDef protocol buffer.
DEPRECATED: Use outputs.
Represents a value produced by an Operation.
A Tensor is a symbolic handle to one of the outputs of an Operation. It does not hold the values of that operation's output, but instead provides a means of computing those values in a TensorFlow Session.
This class has two primary purposes:
A Tensor can be passed as an input to another Operation. This builds a dataflow connection between operations, which enables TensorFlow to execute an entire Graph that represents a large, multi-step computation.
After the graph has been launched in a session, the value of the Tensor can be computed by passing it to Session.run(). t.eval() is a shortcut for calling tf.get_default_session().run(t).
In the following example, c, d, and e are symbolic Tensor objects, whereas result is a numpy array that stores a concrete value:
# Build a dataflow graph. c = tf.constant([[1.0, 2.0], [3.0, 4.0]]) d = tf.constant([[1.0, 1.0], [0.0, 1.0]]) e = tf.matmul(c, d) # Construct a `Session` to execut the graph. sess = tf.Session() # Execute the graph and store the value that `e` represents in `result`. result = sess.run(e)The DType of elements in this tensor.
The string name of this tensor.
The index of this tensor in the outputs of its Operation.
The Graph that contains this tensor.
The Operation that produces this tensor as an output.
Returns a list of Operations that consume this tensor.
A list of Operations.
Evaluates this tensor in a Session.
Calling this method will execute all preceding operations that produce the inputs needed for the operation that produces this tensor.
N.B. Before invoking Tensor.eval(), its graph must have been launched in a session, and either a default session must be available, or session must be specified explicitly.
A numpy array corresponding to the value of this tensor.
Returns the TensorShape that represents the shape of this tensor.
The shape is computed using shape inference functions that are registered for each Operation type using tf.RegisterShape. See TensorShape for more details of what a shape represents.
The inferred shape of a tensor is used to provide shape information without having to launch the graph in a session. This can be used for debugging, and providing early error messages. For example:
c = tf.constant([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]) print c.get_shape() ==> TensorShape([Dimension(2), Dimension(3)]) d = tf.constant([[1.0, 0.0], [0.0, 1.0], [1.0, 0.0], [0.0, 1.0]]) print d.get_shape() ==> TensorShape([Dimension(4), Dimension(2)]) # Raises a ValueError, because `c` and `d` do not have compatible # inner dimensions. e = tf.matmul(c, d) f = tf.matmul(c, d, transpose_a=True, transpose_b=True) print f.get_shape() ==> TensorShape([Dimension(3), Dimension(4)])In some cases, the inferred shape may have unknown dimensions. If the caller has additional information about the values of these dimensions, Tensor.set_shape() can be used to augment the inferred shape.
A TensorShape representing the shape of this tensor.
Updates the shape of this tensor.
This method can be called multiple times, and will merge the given shape with the current shape of this tensor. It can be used to provide additional information about the shape of this tensor that cannot be inferred from the graph alone. For example, this can be used to provide additional information about the shapes of images:
_, image_data = tf.TFRecordReader(...).read(...) image = tf.image.decode_png(image_data, channels=3) # The height and width dimensions of `image` are data dependent, and # cannot be computed without executing the op. print image.get_shape() ==> TensorShape([Dimension(None), Dimension(None), Dimension(3)]) # We know that each image in this dataset is 28 x 28 pixels. image.set_shape([28, 28, 3]) print image.get_shape() ==> TensorShape([Dimension(28), Dimension(28), Dimension(3)])Creates a new Tensor.
The name of the device on which this tensor will be produced, or None.
Represents the type of the elements in a Tensor.
The following DType objects are defined:
tf.float32: 32-bit single-precision floating-point. tf.float64: 64-bit double-precision floating-point. tf.bfloat16: 16-bit truncated floating-point.tf.complex64: 64-bit single-precision complex.
tf.int8: 8-bit signed integer.
tf.uint8: 8-bit unsigned integer. tf.int32: 32-bit signed integer.tf.int64: 64-bit signed integer.
tf.bool: Boolean.
tf.string: String.
tf.qint8: Quantized 8-bit signed integer.
tf.quint8: Quantized 8-bit unsigned integer. tf.qint32: Quantized 32-bit signed integer.In addition, variants of these types with the _ref suffix are defined for reference-typed tensors.
The tf.as_dtype() function converts numpy types and string type names to a DType object.
Returns True if the other DType will be converted to this DType.
The conversion rules are as follows:
DType(T) .is_compatible_with(DType(T)) == True DType(T) .is_compatible_with(DType(T).as_ref) == True DType(T).as_ref.is_compatible_with(DType(T)) == False DType(T).as_ref.is_compatible_with(DType(T).as_ref) == TrueTrue if a Tensor of the other DType will be implicitly converted to this DType.
Returns the string name for this DType.
Returns a non-reference DType based on this DType.
Returns True if this DType represents a reference type.
Returns a reference DType based on this DType.
Returns whether this is a (non-quantized) integer type.
Returns whether this is a quantized data type.
Returns a numpy.dtype based on this DType.
Returns a types_pb2.DataType enum value based on this DType.
Creates a new DataType.
NOTE(mrry): In normal circumstances, you should not need to construct a DataType object directly. Instead, use the types.as_dtype() function.
Returns the maximum representable value in this data type.
Returns the minimum representable value in this data type.
Converts the given type_value to a DType.
A DType corresponding to type_value.
Wrapper for Graph.device() using the default graph.
See Graph.name_scope() for more details.
A context manager that specifies the default device to use for newly created ops.
Wrapper for Graph.name_scope() using the default graph.
See Graph.name_scope() for more details.
A context manager that installs name as a new name scope in the default graph.
Wrapper for Graph.control_dependencies() using the default graph.
See Graph.control_dependencies() for more details.
A context manager that specifies control dependencies for all operations constructed within the context.
Converts the given value to a Tensor.
This function converts Python objects of various types to Tensor objects. It accepts Tensor objects, numpy arrays, Python lists, and Python scalars. For example:
import numpy as np array = np.random.rand((32, 100, 100)) def my_func(arg): arg = tf.convert_to_tensor(arg, dtype=tf.float32) return tf.matmul(arg, arg) + arg # The following calls are equivalent. value_1 = my_func(tf.constant([[1.0, 2.0], [3.0, 4.0]])) value_2 = my_func([[1.0, 2.0], [3.0, 4.0]]) value_3 = my_func(np.array([[1.0, 2.0], [3.0, 4.0]], dtype=np.float32))This function can be useful when composing a new operation in Python (such as my_func in the example above). All standard Python op constructors apply this function to each of their Tensor-valued inputs, which allows those ops to accept numpy arrays, Python lists, and scalars in addition to Tensor objects.
A Tensor based on value.
Returns the default graph for the current thread.
The returned graph will be the innermost graph on which a Graph.as_default() context has been entered, or a global default graph if none has been explicitly created.
N.B. The default graph is a property of the current thread. If you create a new thread, and wish to use the default graph in that thread, you must explicitly add a with g.as_default(): in that thread's function.
The default Graph being used in the current thread.
Imports the TensorFlow graph in graph_def into the Python Graph.
This function provides a way to import a serialized TensorFlow GraphDef protocol buffer, and extract individual objects in the GraphDef as Tensor and Operation objects. See Graph.as_graph_def() for a way to create a GraphDef proto.
A list of Operation and/or Tensor objects from the imported graph, corresponding to the names in `return_elements'.
Wrapper for Graph.add_to_collection() using the default graph.
See Graph.add_to_collection() for more details.
Wrapper for Graph.get_collection() using the default graph.
See Graph.get_collection() for more details.
The list of values in the collection with the given name, or an empty list if no value has been added to that collection. The list contains the values in the order under which they were collected.
Standard names to use for graph collections.
The standard library uses various well-known names to collect and retrieve values associated with a graph. For example, the tf.Optimizer subclasses default to optimizing the variables collected under tf.GraphKeys.TRAINABLE_VARIABLES if none is specified, but it is also possible to pass an explicit list of variables.
The following standard keys are defined:
VARIABLES: the Variable objects that comprise a model, and must be saved and restored together. See tf.all_variables() for more details. TRAINABLE_VARIABLES: the subset of Variable objects that will be trained by an optimizer. Seetf.trainable_variables() for more details. SUMMARIES: the summary Tensor objects that have been created in the graph. Seetf.merge_all_summaries() for more details. QUEUE_RUNNERS: the QueueRunner objects that are used to produce input for a computation. Seetf.start_queue_runners() for more details.A decorator for registering the gradient function for an op type.
This decorator is only used when defining a new op type. For an op with m inputs and n inputs, the gradient function is a function that takes the original Operation and n Tensor objects (representing the gradients with respect to each output of the op), and returns m Tensor objects (representing the partial gradients with respect to each input of the op).
For example, assuming that operations of type "Sub" take two inputs x and y, and return a single output x - y, the following gradient function would be registered:
@tf.RegisterGradient("Sub") def _sub_grad(unused_op, grad): return grad, tf.Neg(grad)The decorator argument op_type is the string type of an operation. This corresponds to the OpDef.namefield for the proto that defines the operation.
Creates a new decorator with op_type as the Operation type.
Specifies that ops of type op_type do not have a defined gradient.
This function is only used when defining a new op type. It may be used for ops such as tf.size() that are not differentiable. For example:
tf.NoGradient("Size")A decorator for registering the shape function for an op type.
This decorator is only used when defining a new op type. A shape function is a function from an Operation object to a list of TensorShape objects, with one TensorShape for each output of the operation.
For example, assuming that operations of type "Sub" take two inputs x and y, and return a single output x - y, all with the same shape, the following shape function would be registered:
@tf.RegisterShape("Sub") def _sub_shape(op): return [op.inputs[0].get_shape().merge_with(op.inputs[1].get_shape())]The decorator argument op_type is the string type of an operation. This corresponds to the OpDef.namefield for the proto that defines the operation.
Saves the "op_type" as the Operation type.
Represents the shape of a Tensor.
A TensorShape represents a possibly-partial shape specification for a Tensor. It may be one of the following:
Fully-known shape: has a known number of dimensions and a known size for each dimension. Partially-known shape: has a known number of dimensions, and an unknown size for one or more dimension. Unknown shape: has an unknown number of dimensions, and an unknown size in all dimensions.If a tensor is produced by an operation of type "Foo", its shape may be inferred if there is a registered shape function for "Foo". See tf.RegisterShape() for details of shape functions and how to register them. Alternatively, the shape may be set explicitly using Tensor.set_shape().
Returns a TensorShape combining the information in self and other.
The dimensions in self and other are merged elementwise, according to the rules defined for Dimension.merge_with().
A TensorShape containing the combined information of self and other.
Returns the concatenation of the dimension in self and other.
N.B. If either self or other is completely unknown, concatenation will discard information about the other shape. In future, we might support concatenation that preserves this information for use with slicing.
A TensorShape whose dimensions are the concatenation of the dimensions in self and other.
Returns the rank of this shape, or None if it is unspecified.
Returns a list of Dimensions, or None if the shape is unspecified.
Returns a list of integers or None for each dimension.
Returns True iff self is compatible with other.
Two possibly-partially-defined shapes are compatible if there exists a fully-defined shape that both shapes can represent. Thus, compatibility allows the shape inference code to reason about partially-defined shapes. For example:
TensorShape(None) is compatible with all shapes.
TensorShape([None, None]) is compatible with all two-dimensional shapes, such as TensorShape([32, 784]), and also TensorShape(None). It is not compatible with, for example, TensorShape([None]) or TensorShape([None, None, None]).
TensorShape([32, None]) is compatible with all two-dimensional shapes with size 32 in the 0th dimension, and also TensorShape([None, None]) and TensorShape(None). It is not compatible with, for example, TensorShape([32]), TensorShape([32, None, 1]) or TensorShape([64, None]).
TensorShape([32, 784]) is compatible with itself, and also TensorShape([32, None]), TensorShape([None, 784]), TensorShape([None, None]) and TensorShape(None). It is not compatible with, for example, TensorShape([32, 1, 784]) or TensorShape([None]).
The compatibility relation is reflexive and symmetric, but not transitive. For example, TensorShape([32, 784]) is compatible with TensorShape(None), and TensorShape(None) is compatible with TensorShape([4, 4]), but TensorShape([32, 784]) is not compatible with TensorShape([4, 4]).
True iff self is compatible with other.
Returns True iff self is fully defined in every dimension.
Returns a shape based on self with the given rank.
This method promotes a completely unknown shape to one with a known rank.
A shape that is at least as specific as self with the given rank.
Returns a shape based on self with at least the given rank.
A shape that is at least as specific as self with at least the given rank.
Returns a shape based on self with at most the given rank.
A shape that is at least as specific as self with at most the given rank.
Raises an exception if self is not compatible with the given rank.
Raises an exception if self and other do not have compatible ranks.
Raises exception if self and other do not represent the same shape.
This method can be used to assert that there exists a shape that both self and other represent.
Raises an exception if self is not fully defined in every dimension.
Creates a new TensorShape with the given dimensions.
DEPRECATED: use as_list().
Returns the total number of elements, or none for incomplete shapes.
Represents the value of one dimension in a TensorShape.
Creates a new Dimension with the given value.
Raises an exception if other is not compatible with this Dimension.
Returns true if other is compatible with this Dimension.
Two known Dimensions are compatible if they have the same value. An unknown Dimension is compatible with all other Dimensions.
True if this Dimension and other are compatible.
Returns a Dimension that combines the information in self and other.
Dimensions are combined as follows:
Dimension(n) .merge_with(Dimension(n)) == Dimension(n) Dimension(n) .merge_with(Dimension(None)) == Dimension(n) Dimension(None).merge_with(Dimension(n)) == Dimension(n) Dimension(None).merge_with(Dimension(None)) == Dimension(None) Dimension(n) .merge_with(Dimension(m)) raises ValueError for n != m
A Dimension containing the combined information of self and other.
The value of this dimension, or None if it is unknown.
Returns a context manager for use when defining a Python op.
This context manager validates that the given values are from the same graph, ensures that that graph is the default graph, and pushes a name scope.
For example, to define a new Python op called my_op:
def my_op(a, b, c, name=None): with tf.op_scope([a, b, c], name, "MyOp") as scope: a = tf.convert_to_tensor(a, name="a") b = tf.convert_to_tensor(b, name="b") c = tf.convert_to_tensor(c, name="c") # Define some computation that uses `a`, `b`, and `c`. return foo_op(..., name=scope)A context manager for use in defining a Python op.
Returns the local seeds an operation should use given an op-specific seed.
Given operation-specific seed, op_seed, this helper function returns two seeds derived from graph-level and op-level seeds. Many random operations internally use the two seeds to allow user to change the seed globally for a graph, or for only specific operations.
For details on how the graph-level seed interacts with op seeds, see set_random_seed.
A tuple of two integers that should be used for the local seed of this operation.
相关资源:视频下载王6.3.5.rar