diff --git a/src/TensorFlowNET.Core/Operations/gen_ops.cs b/src/TensorFlowNET.Core/Operations/gen_ops.cs
new file mode 100644
index 00000000..d3e120e9
--- /dev/null
+++ b/src/TensorFlowNET.Core/Operations/gen_ops.cs
@@ -0,0 +1,39071 @@
+using System;
+using System.Linq;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Tensorflow.Operations
+{
+ public class gen_ops
+ {
+ static readonly OpDefLibrary _op_def_lib;
+ static gen_ops() { _op_def_lib = new OpDefLibrary(); }
+
+ ///
+ /// Raise a exception to abort the process when called.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Abort'.
+ ///
+ ///
+ /// A string which is the message associated with the exception.
+ ///
+ ///
+ ///
+ ///
+ /// Returns the description of the operation
+ ///
+ ///
+ /// If exit_without_error is true, the process will exit normally,
+ /// otherwise it will exit with a SIGABORT signal.
+ ///
+ /// Returns nothing but an exception.
+ ///
+ public static Operation abort (string error_msg = null, bool? exit_without_error = null, string name = "Abort")
+ {
+ var dict = new Dictionary();
+ if (error_msg != null)
+ dict["error_msg"] = error_msg;
+ if (exit_without_error.HasValue)
+ dict["exit_without_error"] = exit_without_error.Value;
+ var op = _op_def_lib._apply_op_helper("Abort", name: name, keywords: dict);
+ return op;
+ }
+
+ ///
+ /// Computes the absolute value of a tensor.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Abs'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Given a tensor x, this operation returns a tensor containing the absolute
+ /// value of each element in x. For example, if x is an input element and y is
+ /// an output element, this operation computes \\(y = |x|\\).
+ ///
+ public static Tensor abs (Tensor x, string name = "Abs")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ var op = _op_def_lib._apply_op_helper("Abs", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Returns the element-wise sum of a list of tensors.
+ ///
+ ///
+ /// A list of Tensor objects, each with same shape and type.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AccumulateNV2'.
+ ///
+ ///
+ /// Optional argument
+ /// Shape of elements of inputs.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// tf.accumulate_n_v2 performs the same operation as tf.add_n, but does not
+ /// wait for all of its inputs to be ready before beginning to sum. This can
+ /// save memory if inputs are ready at different times, since minimum temporary
+ /// storage is proportional to the output size rather than the inputs size.
+ ///
+ /// Unlike the original accumulate_n, accumulate_n_v2 is differentiable.
+ ///
+ /// Returns a Tensor of same shape and type as the elements of inputs.
+ ///
+ public static Tensor accumulate_n_v2 (Tensor[] inputs, TensorShape shape, string name = "AccumulateNV2")
+ {
+ var dict = new Dictionary();
+ dict["inputs"] = inputs;
+ dict["shape"] = shape;
+ var op = _op_def_lib._apply_op_helper("AccumulateNV2", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Applies a gradient to a given accumulator.
+ ///
+ ///
+ /// The handle to a accumulator.
+ ///
+ ///
+ /// The local_step value at which the gradient was computed.
+ ///
+ ///
+ /// A tensor of the gradient to be accumulated.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AccumulatorApplyGradient'.
+ ///
+ ///
+ /// Returns the description of the operation
+ ///
+ ///
+ /// Does not add if local_step is lesser than the accumulator's global_step.
+ ///
+ public static Operation accumulator_apply_gradient (Tensor handle, Tensor local_step, Tensor gradient, string name = "AccumulatorApplyGradient")
+ {
+ var dict = new Dictionary();
+ dict["handle"] = handle;
+ dict["local_step"] = local_step;
+ dict["gradient"] = gradient;
+ var op = _op_def_lib._apply_op_helper("AccumulatorApplyGradient", name: name, keywords: dict);
+ return op;
+ }
+
+ ///
+ /// Returns the number of gradients aggregated in the given accumulators.
+ ///
+ ///
+ /// The handle to an accumulator.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AccumulatorNumAccumulated'.
+ ///
+ ///
+ /// The number of gradients aggregated in the given accumulator.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor accumulator_num_accumulated (Tensor handle, string name = "AccumulatorNumAccumulated")
+ {
+ var dict = new Dictionary();
+ dict["handle"] = handle;
+ var op = _op_def_lib._apply_op_helper("AccumulatorNumAccumulated", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Updates the accumulator with a new value for global_step.
+ ///
+ ///
+ /// The handle to an accumulator.
+ ///
+ ///
+ /// The new global_step value to set.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AccumulatorSetGlobalStep'.
+ ///
+ ///
+ /// Returns the description of the operation
+ ///
+ ///
+ /// Logs warning if the accumulator's value is already higher than
+ /// new_global_step.
+ ///
+ public static Operation accumulator_set_global_step (Tensor handle, Tensor new_global_step, string name = "AccumulatorSetGlobalStep")
+ {
+ var dict = new Dictionary();
+ dict["handle"] = handle;
+ dict["new_global_step"] = new_global_step;
+ var op = _op_def_lib._apply_op_helper("AccumulatorSetGlobalStep", name: name, keywords: dict);
+ return op;
+ }
+
+ ///
+ /// Extracts the average gradient in the given ConditionalAccumulator.
+ ///
+ ///
+ /// The handle to an accumulator.
+ ///
+ ///
+ /// Number of gradients required before we return an aggregate.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AccumulatorTakeGradient'.
+ ///
+ ///
+ /// Optional argument
+ /// The data type of accumulated gradients. Needs to correspond to the type
+ /// of the accumulator.
+ ///
+ ///
+ /// The average of the accumulated gradients.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// The op blocks until sufficient (i.e., more than num_required)
+ /// gradients have been accumulated. If the accumulator has already
+ /// aggregated more than num_required gradients, it returns the average of
+ /// the accumulated gradients. Also automatically increments the recorded
+ /// global_step in the accumulator by 1, and resets the aggregate to 0.
+ ///
+ public static Tensor accumulator_take_gradient (Tensor handle, Tensor num_required, TF_DataType dtype, string name = "AccumulatorTakeGradient")
+ {
+ var dict = new Dictionary();
+ dict["handle"] = handle;
+ dict["num_required"] = num_required;
+ dict["dtype"] = dtype;
+ var op = _op_def_lib._apply_op_helper("AccumulatorTakeGradient", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes acos of x element-wise.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Acos'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor acos (Tensor x, string name = "Acos")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ var op = _op_def_lib._apply_op_helper("Acos", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes inverse hyperbolic cosine of x element-wise.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Acosh'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor acosh (Tensor x, string name = "Acosh")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ var op = _op_def_lib._apply_op_helper("Acosh", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Returns x + y element-wise.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Add'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// *NOTE*: Add supports broadcasting. AddN does not. More about broadcasting
+ /// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html)
+ ///
+ public static Tensor add (Tensor x, Tensor y, string name = "Add")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ dict["y"] = y;
+ var op = _op_def_lib._apply_op_helper("Add", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Add an N-minibatch SparseTensor to a SparseTensorsMap, return N handles.
+ ///
+ ///
+ /// 2-D. The indices of the minibatch SparseTensor.
+ /// sparse_indices[:, 0] must be ordered values in [0, N).
+ ///
+ ///
+ /// 1-D. The values of the minibatch SparseTensor.
+ ///
+ ///
+ /// 1-D. The shape of the minibatch SparseTensor.
+ /// The minibatch size N == sparse_shape[0].
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AddManySparseToTensorsMap'.
+ ///
+ ///
+ /// The container name for the SparseTensorsMap created by this op.
+ ///
+ ///
+ /// The shared name for the SparseTensorsMap created by this op.
+ /// If blank, the new Operation's unique name is used.
+ ///
+ ///
+ /// 1-D. The handles of the SparseTensor now stored in the
+ /// SparseTensorsMap. Shape: [N].
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// A SparseTensor of rank R is represented by three tensors: sparse_indices,
+ /// sparse_values, and sparse_shape, where
+ ///
+ ///
+ /// sparse_indices.shape[1] == sparse_shape.shape[0] == R
+ ///
+ ///
+ /// An N-minibatch of SparseTensor objects is represented as a SparseTensor
+ /// having a first sparse_indices column taking values between [0, N), where
+ /// the minibatch size N == sparse_shape[0].
+ ///
+ /// The input SparseTensor must have rank R greater than 1, and the first
+ /// dimension is treated as the minibatch dimension. Elements of the SparseTensor
+ /// must be sorted in increasing order of this first dimension. The stored
+ /// SparseTensor objects pointed to by each row of the output sparse_handles
+ /// will have rank R-1.
+ ///
+ /// The SparseTensor values can then be read out as part of a minibatch by passing
+ /// the given keys as vector elements to TakeManySparseFromTensorsMap. To ensure
+ /// the correct SparseTensorsMap is accessed, ensure that the same
+ /// container and shared_name are passed to that Op. If no shared_name
+ /// is provided here, instead use the *name* of the Operation created by calling
+ /// AddManySparseToTensorsMap as the shared_name passed to
+ /// TakeManySparseFromTensorsMap. Ensure the Operations are colocated.
+ ///
+ public static Tensor add_many_sparse_to_tensors_map (Tensor sparse_indices, Tensor sparse_values, Tensor sparse_shape, string container = null, string shared_name = null, string name = "AddManySparseToTensorsMap")
+ {
+ var dict = new Dictionary();
+ dict["sparse_indices"] = sparse_indices;
+ dict["sparse_values"] = sparse_values;
+ dict["sparse_shape"] = sparse_shape;
+ if (container != null)
+ dict["container"] = container;
+ if (shared_name != null)
+ dict["shared_name"] = shared_name;
+ var op = _op_def_lib._apply_op_helper("AddManySparseToTensorsMap", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Add all input tensors element wise.
+ ///
+ ///
+ /// Must all be the same size and shape.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AddN'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor add_n (Tensor[] inputs, string name = "AddN")
+ {
+ var dict = new Dictionary();
+ dict["inputs"] = inputs;
+ var op = _op_def_lib._apply_op_helper("AddN", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Add a SparseTensor to a SparseTensorsMap return its handle.
+ ///
+ ///
+ /// 2-D. The indices of the SparseTensor.
+ ///
+ ///
+ /// 1-D. The values of the SparseTensor.
+ ///
+ ///
+ /// 1-D. The shape of the SparseTensor.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AddSparseToTensorsMap'.
+ ///
+ ///
+ /// The container name for the SparseTensorsMap created by this op.
+ ///
+ ///
+ /// The shared name for the SparseTensorsMap created by this op.
+ /// If blank, the new Operation's unique name is used.
+ ///
+ ///
+ /// 0-D. The handle of the SparseTensor now stored in the
+ /// SparseTensorsMap.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// A SparseTensor is represented by three tensors: sparse_indices,
+ /// sparse_values, and sparse_shape.
+ ///
+ /// This operator takes the given SparseTensor and adds it to a container
+ /// object (a SparseTensorsMap). A unique key within this container is generated
+ /// in the form of an int64, and this is the value that is returned.
+ ///
+ /// The SparseTensor can then be read out as part of a minibatch by passing
+ /// the key as a vector element to TakeManySparseFromTensorsMap. To ensure
+ /// the correct SparseTensorsMap is accessed, ensure that the same
+ /// container and shared_name are passed to that Op. If no shared_name
+ /// is provided here, instead use the *name* of the Operation created by calling
+ /// AddSparseToTensorsMap as the shared_name passed to
+ /// TakeManySparseFromTensorsMap. Ensure the Operations are colocated.
+ ///
+ public static Tensor add_sparse_to_tensors_map (Tensor sparse_indices, Tensor sparse_values, Tensor sparse_shape, string container = null, string shared_name = null, string name = "AddSparseToTensorsMap")
+ {
+ var dict = new Dictionary();
+ dict["sparse_indices"] = sparse_indices;
+ dict["sparse_values"] = sparse_values;
+ dict["sparse_shape"] = sparse_shape;
+ if (container != null)
+ dict["container"] = container;
+ if (shared_name != null)
+ dict["shared_name"] = shared_name;
+ var op = _op_def_lib._apply_op_helper("AddSparseToTensorsMap", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Returns x + y element-wise.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AddV2'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// *NOTE*: Add supports broadcasting. AddN does not. More about broadcasting
+ /// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html)
+ ///
+ public static Tensor add_v2 (Tensor x, Tensor y, string name = "AddV2")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ dict["y"] = y;
+ var op = _op_def_lib._apply_op_helper("AddV2", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Deprecated. Disallowed in GraphDef version >= 2.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AdjustContrast'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor adjust_contrast (Tensor images, Tensor contrast_factor, Tensor min_value, Tensor max_value, string name = "AdjustContrast")
+ {
+ var dict = new Dictionary();
+ dict["images"] = images;
+ dict["contrast_factor"] = contrast_factor;
+ dict["min_value"] = min_value;
+ dict["max_value"] = max_value;
+ var op = _op_def_lib._apply_op_helper("AdjustContrast", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Adjust the contrast of one or more images.
+ ///
+ ///
+ /// Images to adjust. At least 3-D.
+ ///
+ ///
+ /// A float multiplier for adjusting contrast.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AdjustContrastv2'.
+ ///
+ ///
+ /// The contrast-adjusted image or images.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// images is a tensor of at least 3 dimensions. The last 3 dimensions are
+ /// interpreted as [height, width, channels]. The other dimensions only
+ /// represent a collection of images, such as [batch, height, width, channels].
+ ///
+ /// Contrast is adjusted independently for each channel of each image.
+ ///
+ /// For each channel, the Op first computes the mean of the image pixels in the
+ /// channel and then adjusts each component of each pixel to
+ /// (x - mean) * contrast_factor + mean.
+ ///
+ public static Tensor adjust_contrastv2 (Tensor images, Tensor contrast_factor, string name = "AdjustContrastv2")
+ {
+ var dict = new Dictionary();
+ dict["images"] = images;
+ dict["contrast_factor"] = contrast_factor;
+ var op = _op_def_lib._apply_op_helper("AdjustContrastv2", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Adjust the hue of one or more images.
+ ///
+ ///
+ /// Images to adjust. At least 3-D.
+ ///
+ ///
+ /// A float delta to add to the hue.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AdjustHue'.
+ ///
+ ///
+ /// The hue-adjusted image or images.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// images is a tensor of at least 3 dimensions. The last dimension is
+ /// interpretted as channels, and must be three.
+ ///
+ /// The input image is considered in the RGB colorspace. Conceptually, the RGB
+ /// colors are first mapped into HSV. A delta is then applied all the hue values,
+ /// and then remapped back to RGB colorspace.
+ ///
+ public static Tensor adjust_hue (Tensor images, Tensor delta, string name = "AdjustHue")
+ {
+ var dict = new Dictionary();
+ dict["images"] = images;
+ dict["delta"] = delta;
+ var op = _op_def_lib._apply_op_helper("AdjustHue", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Adjust the saturation of one or more images.
+ ///
+ ///
+ /// Images to adjust. At least 3-D.
+ ///
+ ///
+ /// A float scale to add to the saturation.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AdjustSaturation'.
+ ///
+ ///
+ /// The hue-adjusted image or images.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// images is a tensor of at least 3 dimensions. The last dimension is
+ /// interpretted as channels, and must be three.
+ ///
+ /// The input image is considered in the RGB colorspace. Conceptually, the RGB
+ /// colors are first mapped into HSV. A scale is then applied all the saturation
+ /// values, and then remapped back to RGB colorspace.
+ ///
+ public static Tensor adjust_saturation (Tensor images, Tensor scale, string name = "AdjustSaturation")
+ {
+ var dict = new Dictionary();
+ dict["images"] = images;
+ dict["scale"] = scale;
+ var op = _op_def_lib._apply_op_helper("AdjustSaturation", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes the "logical and" of elements across dimensions of a tensor.
+ ///
+ ///
+ /// The tensor to reduce.
+ ///
+ ///
+ /// The dimensions to reduce. Must be in the range
+ /// [-rank(input), rank(input)).
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'All'.
+ ///
+ ///
+ /// If true, retain reduced dimensions with length 1.
+ ///
+ ///
+ /// The reduced tensor.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Reduces input along the dimensions given in axis. Unless
+ /// keep_dims is true, the rank of the tensor is reduced by 1 for each entry in
+ /// axis. If keep_dims is true, the reduced dimensions are
+ /// retained with length 1.
+ ///
+ public static Tensor all (Tensor input, Tensor reduction_indices, bool? keep_dims = null, string name = "All")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["reduction_indices"] = reduction_indices;
+ if (keep_dims.HasValue)
+ dict["keep_dims"] = keep_dims.Value;
+ var op = _op_def_lib._apply_op_helper("All", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Generates labels for candidate sampling with a learned unigram distribution.
+ ///
+ ///
+ /// A batch_size * num_true matrix, in which each row contains the
+ /// IDs of the num_true target_classes in the corresponding original label.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AllCandidateSampler'.
+ ///
+ ///
+ /// Optional argument
+ /// Number of true labels per context.
+ ///
+ ///
+ /// Optional argument
+ /// Number of candidates to produce.
+ ///
+ ///
+ /// Optional argument
+ /// If unique is true, we sample with rejection, so that all sampled
+ /// candidates in a batch are unique. This requires some approximation to
+ /// estimate the post-rejection sampling probabilities.
+ ///
+ ///
+ /// If either seed or seed2 are set to be non-zero, the random number
+ /// generator is seeded by the given seed. Otherwise, it is seeded by a
+ /// random seed.
+ ///
+ ///
+ /// An second seed to avoid seed collision.
+ ///
+ ///
+ /// Returns a tuple with multiple values, as follows:
+ /// sampled_candidates : A vector of length num_sampled, in which each element is
+ /// the ID of a sampled candidate.
+ /// true_expected_count : A batch_size * num_true matrix, representing
+ /// the number of times each candidate is expected to occur in a batch
+ /// of sampled candidates. If unique=true, then this is a probability.
+ /// sampled_expected_count : A vector of length num_sampled, for each sampled
+ /// candidate representing the number of times the candidate is expected
+ /// to occur in a batch of sampled candidates. If unique=true, then this is a
+ /// probability.
+ /// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
+ ///
+ ///
+ /// See explanations of candidate sampling and the data formats at
+ /// go/candidate-sampling.
+ ///
+ /// For each batch, this op picks a single set of sampled candidate labels.
+ ///
+ /// The advantages of sampling candidates per-batch are simplicity and the
+ /// possibility of efficient dense matrix multiplication. The disadvantage is that
+ /// the sampled candidates must be chosen independently of the context and of the
+ /// true labels.
+ ///
+ public static (Tensor sampled_candidates, Tensor true_expected_count, Tensor sampled_expected_count) all_candidate_sampler (Tensor true_classes, int num_true, int num_sampled, bool unique, int? seed = null, int? seed2 = null, string name = "AllCandidateSampler")
+ {
+ var dict = new Dictionary();
+ dict["true_classes"] = true_classes;
+ dict["num_true"] = num_true;
+ dict["num_sampled"] = num_sampled;
+ dict["unique"] = unique;
+ if (seed.HasValue)
+ dict["seed"] = seed.Value;
+ if (seed2.HasValue)
+ dict["seed2"] = seed2.Value;
+ var op = _op_def_lib._apply_op_helper("AllCandidateSampler", name: name, keywords: dict);
+ int _idx = 0;
+ var sampled_candidates = op.outputs[_idx++];
+ var true_expected_count = op.outputs[_idx++];
+ var sampled_expected_count = op.outputs[_idx++];
+ return (sampled_candidates, true_expected_count, sampled_expected_count);
+ }
+
+ ///
+ /// Returns the argument of a complex number.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Angle'.
+ ///
+ ///
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Given a tensor input of complex numbers, this operation returns a tensor of
+ /// type float that is the argument of each element in input. All elements in
+ /// input must be complex numbers of the form \\(a + bj\\), where *a*
+ /// is the real part and *b* is the imaginary part.
+ ///
+ /// The argument returned by this operation is of the form \\(atan2(b, a)\\).
+ ///
+ /// For example:
+ ///
+ ///
+ /// # tensor 'input' is [-2.25 + 4.75j, 3.25 + 5.75j]
+ /// tf.angle(input) ==> [2.0132, 1.056]
+ ///
+ ///
+ /// @compatibility(numpy)
+ /// Equivalent to np.angle.
+ /// @end_compatibility
+ ///
+ public static Tensor angle (Tensor input, TF_DataType? Tout = null, string name = "Angle")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ if (Tout.HasValue)
+ dict["Tout"] = Tout.Value;
+ var op = _op_def_lib._apply_op_helper("Angle", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// A container for an iterator resource.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AnonymousIterator'.
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// A handle to the iterator that can be passed to a "MakeIterator" or
+ /// "IteratorGetNext" op. In contrast to Iterator, AnonymousIterator prevents
+ /// resource sharing by name, and does not keep a reference to the resource
+ /// container.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor anonymous_iterator (TF_DataType[] output_types, TensorShape[] output_shapes, string name = "AnonymousIterator")
+ {
+ var dict = new Dictionary();
+ dict["output_types"] = output_types;
+ dict["output_shapes"] = output_shapes;
+ var op = _op_def_lib._apply_op_helper("AnonymousIterator", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes the "logical or" of elements across dimensions of a tensor.
+ ///
+ ///
+ /// The tensor to reduce.
+ ///
+ ///
+ /// The dimensions to reduce. Must be in the range
+ /// [-rank(input), rank(input)).
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Any'.
+ ///
+ ///
+ /// If true, retain reduced dimensions with length 1.
+ ///
+ ///
+ /// The reduced tensor.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Reduces input along the dimensions given in axis. Unless
+ /// keep_dims is true, the rank of the tensor is reduced by 1 for each entry in
+ /// axis. If keep_dims is true, the reduced dimensions are
+ /// retained with length 1.
+ ///
+ public static Tensor any (Tensor input, Tensor reduction_indices, bool? keep_dims = null, string name = "Any")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["reduction_indices"] = reduction_indices;
+ if (keep_dims.HasValue)
+ dict["keep_dims"] = keep_dims.Value;
+ var op = _op_def_lib._apply_op_helper("Any", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Update '*var' according to the AdaMax algorithm.
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Must be a scalar.
+ ///
+ ///
+ /// Scaling factor. Must be a scalar.
+ ///
+ ///
+ /// Momentum factor. Must be a scalar.
+ ///
+ ///
+ /// Momentum factor. Must be a scalar.
+ ///
+ ///
+ /// Ridge term. Must be a scalar.
+ ///
+ ///
+ /// The gradient.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ApplyAdaMax'.
+ ///
+ ///
+ /// If True, updating of the var, m, and v tensors will be protected
+ /// by a lock; otherwise the behavior is undefined, but may exhibit less
+ /// contention.
+ ///
+ ///
+ /// Same as "var".
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// m_t <- beta1 * m_{t-1} + (1 - beta1) * g
+ /// v_t <- max(beta2 * v_{t-1}, abs(g))
+ /// variable <- variable - learning_rate / (1 - beta1^t) * m_t / (v_t + epsilon)
+ ///
+ public static Tensor apply_ada_max (Tensor var, Tensor m, Tensor v, Tensor beta1_power, Tensor lr, Tensor beta1, Tensor beta2, Tensor epsilon, Tensor grad, bool? use_locking = null, string name = "ApplyAdaMax")
+ {
+ var dict = new Dictionary();
+ dict["var"] = var;
+ dict["m"] = m;
+ dict["v"] = v;
+ dict["beta1_power"] = beta1_power;
+ dict["lr"] = lr;
+ dict["beta1"] = beta1;
+ dict["beta2"] = beta2;
+ dict["epsilon"] = epsilon;
+ dict["grad"] = grad;
+ if (use_locking.HasValue)
+ dict["use_locking"] = use_locking.Value;
+ var op = _op_def_lib._apply_op_helper("ApplyAdaMax", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Update '*var' according to the adadelta scheme.
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Scaling factor. Must be a scalar.
+ ///
+ ///
+ /// Decay factor. Must be a scalar.
+ ///
+ ///
+ /// Constant factor. Must be a scalar.
+ ///
+ ///
+ /// The gradient.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ApplyAdadelta'.
+ ///
+ ///
+ /// If True, updating of the var, accum and update_accum tensors will be protected by
+ /// a lock; otherwise the behavior is undefined, but may exhibit less contention.
+ ///
+ ///
+ /// Same as "var".
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// accum = rho() * accum + (1 - rho()) * grad.square();
+ /// update = (update_accum + epsilon).sqrt() * (accum + epsilon()).rsqrt() * grad;
+ /// update_accum = rho() * update_accum + (1 - rho()) * update.square();
+ /// var -= update;
+ ///
+ public static Tensor apply_adadelta (Tensor var, Tensor accum, Tensor accum_update, Tensor lr, Tensor rho, Tensor epsilon, Tensor grad, bool? use_locking = null, string name = "ApplyAdadelta")
+ {
+ var dict = new Dictionary();
+ dict["var"] = var;
+ dict["accum"] = accum;
+ dict["accum_update"] = accum_update;
+ dict["lr"] = lr;
+ dict["rho"] = rho;
+ dict["epsilon"] = epsilon;
+ dict["grad"] = grad;
+ if (use_locking.HasValue)
+ dict["use_locking"] = use_locking.Value;
+ var op = _op_def_lib._apply_op_helper("ApplyAdadelta", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Update '*var' according to the adagrad scheme.
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Scaling factor. Must be a scalar.
+ ///
+ ///
+ /// The gradient.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ApplyAdagrad'.
+ ///
+ ///
+ /// If True, updating of the var and accum tensors will be protected
+ /// by a lock; otherwise the behavior is undefined, but may exhibit less
+ /// contention.
+ ///
+ ///
+ ///
+ ///
+ /// Same as "var".
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// accum += grad * grad
+ /// var -= lr * grad * (1 / sqrt(accum))
+ ///
+ public static Tensor apply_adagrad (Tensor var, Tensor accum, Tensor lr, Tensor grad, bool? use_locking = null, bool? update_slots = null, string name = "ApplyAdagrad")
+ {
+ var dict = new Dictionary();
+ dict["var"] = var;
+ dict["accum"] = accum;
+ dict["lr"] = lr;
+ dict["grad"] = grad;
+ if (use_locking.HasValue)
+ dict["use_locking"] = use_locking.Value;
+ if (update_slots.HasValue)
+ dict["update_slots"] = update_slots.Value;
+ var op = _op_def_lib._apply_op_helper("ApplyAdagrad", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Update '*var' according to the proximal adagrad scheme.
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// The gradient.
+ ///
+ ///
+ /// Scaling factor. Must be a scalar.
+ ///
+ ///
+ /// L1 regularization. Must be a scalar.
+ ///
+ ///
+ /// L2 regularization. Must be a scalar.
+ ///
+ ///
+ /// Training step number. Must be a scalar.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ApplyAdagradDA'.
+ ///
+ ///
+ /// If True, updating of the var and accum tensors will be protected by
+ /// a lock; otherwise the behavior is undefined, but may exhibit less contention.
+ ///
+ ///
+ /// Same as "var".
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor apply_adagrad_d_a (Tensor var, Tensor gradient_accumulator, Tensor gradient_squared_accumulator, Tensor grad, Tensor lr, Tensor l1, Tensor l2, Tensor global_step, bool? use_locking = null, string name = "ApplyAdagradDA")
+ {
+ var dict = new Dictionary();
+ dict["var"] = var;
+ dict["gradient_accumulator"] = gradient_accumulator;
+ dict["gradient_squared_accumulator"] = gradient_squared_accumulator;
+ dict["grad"] = grad;
+ dict["lr"] = lr;
+ dict["l1"] = l1;
+ dict["l2"] = l2;
+ dict["global_step"] = global_step;
+ if (use_locking.HasValue)
+ dict["use_locking"] = use_locking.Value;
+ var op = _op_def_lib._apply_op_helper("ApplyAdagradDA", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Update '*var' according to the Adam algorithm.
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Must be a scalar.
+ ///
+ ///
+ /// Must be a scalar.
+ ///
+ ///
+ /// Scaling factor. Must be a scalar.
+ ///
+ ///
+ /// Momentum factor. Must be a scalar.
+ ///
+ ///
+ /// Momentum factor. Must be a scalar.
+ ///
+ ///
+ /// Ridge term. Must be a scalar.
+ ///
+ ///
+ /// The gradient.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ApplyAdam'.
+ ///
+ ///
+ /// If True, updating of the var, m, and v tensors will be protected
+ /// by a lock; otherwise the behavior is undefined, but may exhibit less
+ /// contention.
+ ///
+ ///
+ /// If True, uses the nesterov update.
+ ///
+ ///
+ /// Same as "var".
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// $$lr_t := \text{learning\_rate} * \sqrt{1 - beta_2^t} / (1 - beta_1^t)$$
+ /// $$m_t := beta_1 * m_{t-1} + (1 - beta_1) * g$$
+ /// $$v_t := beta_2 * v_{t-1} + (1 - beta_2) * g * g$$
+ /// $$variable := variable - lr_t * m_t / (\sqrt{v_t} + \epsilon)$$
+ ///
+ public static Tensor apply_adam (Tensor var, Tensor m, Tensor v, Tensor beta1_power, Tensor beta2_power, Tensor lr, Tensor beta1, Tensor beta2, Tensor epsilon, Tensor grad, bool? use_locking = null, bool? use_nesterov = null, string name = "ApplyAdam")
+ {
+ var dict = new Dictionary();
+ dict["var"] = var;
+ dict["m"] = m;
+ dict["v"] = v;
+ dict["beta1_power"] = beta1_power;
+ dict["beta2_power"] = beta2_power;
+ dict["lr"] = lr;
+ dict["beta1"] = beta1;
+ dict["beta2"] = beta2;
+ dict["epsilon"] = epsilon;
+ dict["grad"] = grad;
+ if (use_locking.HasValue)
+ dict["use_locking"] = use_locking.Value;
+ if (use_nesterov.HasValue)
+ dict["use_nesterov"] = use_nesterov.Value;
+ var op = _op_def_lib._apply_op_helper("ApplyAdam", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Update '*var' according to the AddSign update.
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Scaling factor. Must be a scalar.
+ ///
+ ///
+ /// Must be a scalar.
+ ///
+ ///
+ /// Must be a scalar.
+ ///
+ ///
+ /// Must be a scalar.
+ ///
+ ///
+ /// The gradient.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ApplyAddSign'.
+ ///
+ ///
+ /// If True, updating of the var and m tensors is
+ /// protected by a lock; otherwise the behavior is undefined, but may exhibit less
+ /// contention.
+ ///
+ ///
+ /// Same as "var".
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// m_t <- beta1 * m_{t-1} + (1 - beta1) * g
+ /// update <- (alpha + sign_decay * sign(g) *sign(m)) * g
+ /// variable <- variable - lr_t * update
+ ///
+ public static Tensor apply_add_sign (Tensor var, Tensor m, Tensor lr, Tensor alpha, Tensor sign_decay, Tensor beta, Tensor grad, bool? use_locking = null, string name = "ApplyAddSign")
+ {
+ var dict = new Dictionary();
+ dict["var"] = var;
+ dict["m"] = m;
+ dict["lr"] = lr;
+ dict["alpha"] = alpha;
+ dict["sign_decay"] = sign_decay;
+ dict["beta"] = beta;
+ dict["grad"] = grad;
+ if (use_locking.HasValue)
+ dict["use_locking"] = use_locking.Value;
+ var op = _op_def_lib._apply_op_helper("ApplyAddSign", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Update '*var' according to the centered RMSProp algorithm.
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Scaling factor. Must be a scalar.
+ ///
+ ///
+ /// Decay rate. Must be a scalar.
+ ///
+ ///
+ ///
+ ///
+ /// Ridge term. Must be a scalar.
+ ///
+ ///
+ /// The gradient.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ApplyCenteredRMSProp'.
+ ///
+ ///
+ /// If True, updating of the var, mg, ms, and mom tensors is
+ /// protected by a lock; otherwise the behavior is undefined, but may exhibit less
+ /// contention.
+ ///
+ ///
+ /// Same as "var".
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// The centered RMSProp algorithm uses an estimate of the centered second moment
+ /// (i.e., the variance) for normalization, as opposed to regular RMSProp, which
+ /// uses the (uncentered) second moment. This often helps with training, but is
+ /// slightly more expensive in terms of computation and memory.
+ ///
+ /// Note that in dense implementation of this algorithm, mg, ms, and mom will
+ /// update even if the grad is zero, but in this sparse implementation, mg, ms,
+ /// and mom will not update in iterations during which the grad is zero.
+ ///
+ /// mean_square = decay * mean_square + (1-decay) * gradient ** 2
+ /// mean_grad = decay * mean_grad + (1-decay) * gradient
+ ///
+ /// Delta = learning_rate * gradient / sqrt(mean_square + epsilon - mean_grad ** 2)
+ ///
+ /// mg <- rho * mg_{t-1} + (1-rho) * grad
+ /// ms <- rho * ms_{t-1} + (1-rho) * grad * grad
+ /// mom <- momentum * mom_{t-1} + lr * grad / sqrt(ms - mg * mg + epsilon)
+ /// var <- var - mom
+ ///
+ public static Tensor apply_centered_r_m_s_prop (Tensor var, Tensor mg, Tensor ms, Tensor mom, Tensor lr, Tensor rho, Tensor momentum, Tensor epsilon, Tensor grad, bool? use_locking = null, string name = "ApplyCenteredRMSProp")
+ {
+ var dict = new Dictionary();
+ dict["var"] = var;
+ dict["mg"] = mg;
+ dict["ms"] = ms;
+ dict["mom"] = mom;
+ dict["lr"] = lr;
+ dict["rho"] = rho;
+ dict["momentum"] = momentum;
+ dict["epsilon"] = epsilon;
+ dict["grad"] = grad;
+ if (use_locking.HasValue)
+ dict["use_locking"] = use_locking.Value;
+ var op = _op_def_lib._apply_op_helper("ApplyCenteredRMSProp", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Update '*var' according to the Ftrl-proximal scheme.
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// The gradient.
+ ///
+ ///
+ /// Scaling factor. Must be a scalar.
+ ///
+ ///
+ /// L1 regulariation. Must be a scalar.
+ ///
+ ///
+ /// L2 regulariation. Must be a scalar.
+ ///
+ ///
+ /// Scaling factor. Must be a scalar.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ApplyFtrl'.
+ ///
+ ///
+ /// If True, updating of the var and accum tensors will be protected
+ /// by a lock; otherwise the behavior is undefined, but may exhibit less
+ /// contention.
+ ///
+ ///
+ /// Same as "var".
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// accum_new = accum + grad * grad
+ /// linear += grad + (accum_new^(-lr_power) - accum^(-lr_power)) / lr * var
+ /// quadratic = 1.0 / (accum_new^(lr_power) * lr) + 2 * l2
+ /// var = (sign(linear) * l1 - linear) / quadratic if |linear| > l1 else 0.0
+ /// accum = accum_new
+ ///
+ public static Tensor apply_ftrl (Tensor var, Tensor accum, Tensor linear, Tensor grad, Tensor lr, Tensor l1, Tensor l2, Tensor lr_power, bool? use_locking = null, string name = "ApplyFtrl")
+ {
+ var dict = new Dictionary();
+ dict["var"] = var;
+ dict["accum"] = accum;
+ dict["linear"] = linear;
+ dict["grad"] = grad;
+ dict["lr"] = lr;
+ dict["l1"] = l1;
+ dict["l2"] = l2;
+ dict["lr_power"] = lr_power;
+ if (use_locking.HasValue)
+ dict["use_locking"] = use_locking.Value;
+ var op = _op_def_lib._apply_op_helper("ApplyFtrl", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Update '*var' according to the Ftrl-proximal scheme.
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// The gradient.
+ ///
+ ///
+ /// Scaling factor. Must be a scalar.
+ ///
+ ///
+ /// L1 regulariation. Must be a scalar.
+ ///
+ ///
+ /// L2 shrinkage regulariation. Must be a scalar.
+ ///
+ ///
+ ///
+ ///
+ /// Scaling factor. Must be a scalar.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ApplyFtrlV2'.
+ ///
+ ///
+ /// If True, updating of the var and accum tensors will be protected
+ /// by a lock; otherwise the behavior is undefined, but may exhibit less
+ /// contention.
+ ///
+ ///
+ /// Same as "var".
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// grad_with_shrinkage = grad + 2 * l2_shrinkage * var
+ /// accum_new = accum + grad_with_shrinkage * grad_with_shrinkage
+ /// linear += grad_with_shrinkage +
+ /// (accum_new^(-lr_power) - accum^(-lr_power)) / lr * var
+ /// quadratic = 1.0 / (accum_new^(lr_power) * lr) + 2 * l2
+ /// var = (sign(linear) * l1 - linear) / quadratic if |linear| > l1 else 0.0
+ /// accum = accum_new
+ ///
+ public static Tensor apply_ftrl_v2 (Tensor var, Tensor accum, Tensor linear, Tensor grad, Tensor lr, Tensor l1, Tensor l2, Tensor l2_shrinkage, Tensor lr_power, bool? use_locking = null, string name = "ApplyFtrlV2")
+ {
+ var dict = new Dictionary();
+ dict["var"] = var;
+ dict["accum"] = accum;
+ dict["linear"] = linear;
+ dict["grad"] = grad;
+ dict["lr"] = lr;
+ dict["l1"] = l1;
+ dict["l2"] = l2;
+ dict["l2_shrinkage"] = l2_shrinkage;
+ dict["lr_power"] = lr_power;
+ if (use_locking.HasValue)
+ dict["use_locking"] = use_locking.Value;
+ var op = _op_def_lib._apply_op_helper("ApplyFtrlV2", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Update '*var' by subtracting 'alpha' * 'delta' from it.
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Scaling factor. Must be a scalar.
+ ///
+ ///
+ /// The change.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ApplyGradientDescent'.
+ ///
+ ///
+ /// If True, the subtraction will be protected by a lock;
+ /// otherwise the behavior is undefined, but may exhibit less contention.
+ ///
+ ///
+ /// Same as "var".
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor apply_gradient_descent (Tensor var, Tensor alpha, Tensor delta, bool? use_locking = null, string name = "ApplyGradientDescent")
+ {
+ var dict = new Dictionary();
+ dict["var"] = var;
+ dict["alpha"] = alpha;
+ dict["delta"] = delta;
+ if (use_locking.HasValue)
+ dict["use_locking"] = use_locking.Value;
+ var op = _op_def_lib._apply_op_helper("ApplyGradientDescent", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Update '*var' according to the momentum scheme. Set use_nesterov = True if you
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Scaling factor. Must be a scalar.
+ ///
+ ///
+ /// The gradient.
+ ///
+ ///
+ /// Momentum. Must be a scalar.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ApplyMomentum'.
+ ///
+ ///
+ /// If True, updating of the var and accum tensors will be protected
+ /// by a lock; otherwise the behavior is undefined, but may exhibit less
+ /// contention.
+ ///
+ ///
+ /// If True, the tensor passed to compute grad will be
+ /// var - lr * momentum * accum, so in the end, the var you get is actually
+ /// var - lr * momentum * accum.
+ ///
+ ///
+ /// Same as "var".
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// want to use Nesterov momentum.
+ ///
+ /// accum = accum * momentum + grad
+ /// var -= lr * accum
+ ///
+ public static Tensor apply_momentum (Tensor var, Tensor accum, Tensor lr, Tensor grad, Tensor momentum, bool? use_locking = null, bool? use_nesterov = null, string name = "ApplyMomentum")
+ {
+ var dict = new Dictionary();
+ dict["var"] = var;
+ dict["accum"] = accum;
+ dict["lr"] = lr;
+ dict["grad"] = grad;
+ dict["momentum"] = momentum;
+ if (use_locking.HasValue)
+ dict["use_locking"] = use_locking.Value;
+ if (use_nesterov.HasValue)
+ dict["use_nesterov"] = use_nesterov.Value;
+ var op = _op_def_lib._apply_op_helper("ApplyMomentum", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Update '*var' according to the AddSign update.
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Scaling factor. Must be a scalar.
+ ///
+ ///
+ /// Must be a scalar.
+ ///
+ ///
+ /// Must be a scalar.
+ ///
+ ///
+ /// Must be a scalar.
+ ///
+ ///
+ /// The gradient.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ApplyPowerSign'.
+ ///
+ ///
+ /// If True, updating of the var and m tensors is
+ /// protected by a lock; otherwise the behavior is undefined, but may exhibit less
+ /// contention.
+ ///
+ ///
+ /// Same as "var".
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// m_t <- beta1 * m_{t-1} + (1 - beta1) * g
+ /// update <- exp(logbase * sign_decay * sign(g) * sign(m_t)) * g
+ /// variable <- variable - lr_t * update
+ ///
+ public static Tensor apply_power_sign (Tensor var, Tensor m, Tensor lr, Tensor logbase, Tensor sign_decay, Tensor beta, Tensor grad, bool? use_locking = null, string name = "ApplyPowerSign")
+ {
+ var dict = new Dictionary();
+ dict["var"] = var;
+ dict["m"] = m;
+ dict["lr"] = lr;
+ dict["logbase"] = logbase;
+ dict["sign_decay"] = sign_decay;
+ dict["beta"] = beta;
+ dict["grad"] = grad;
+ if (use_locking.HasValue)
+ dict["use_locking"] = use_locking.Value;
+ var op = _op_def_lib._apply_op_helper("ApplyPowerSign", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Update '*var' and '*accum' according to FOBOS with Adagrad learning rate.
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Scaling factor. Must be a scalar.
+ ///
+ ///
+ /// L1 regularization. Must be a scalar.
+ ///
+ ///
+ /// L2 regularization. Must be a scalar.
+ ///
+ ///
+ /// The gradient.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ApplyProximalAdagrad'.
+ ///
+ ///
+ /// If True, updating of the var and accum tensors will be protected by
+ /// a lock; otherwise the behavior is undefined, but may exhibit less contention.
+ ///
+ ///
+ /// Same as "var".
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// accum += grad * grad
+ /// prox_v = var - lr * grad * (1 / sqrt(accum))
+ /// var = sign(prox_v)/(1+lr*l2) * max{|prox_v|-lr*l1,0}
+ ///
+ public static Tensor apply_proximal_adagrad (Tensor var, Tensor accum, Tensor lr, Tensor l1, Tensor l2, Tensor grad, bool? use_locking = null, string name = "ApplyProximalAdagrad")
+ {
+ var dict = new Dictionary();
+ dict["var"] = var;
+ dict["accum"] = accum;
+ dict["lr"] = lr;
+ dict["l1"] = l1;
+ dict["l2"] = l2;
+ dict["grad"] = grad;
+ if (use_locking.HasValue)
+ dict["use_locking"] = use_locking.Value;
+ var op = _op_def_lib._apply_op_helper("ApplyProximalAdagrad", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Update '*var' as FOBOS algorithm with fixed learning rate.
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Scaling factor. Must be a scalar.
+ ///
+ ///
+ /// L1 regularization. Must be a scalar.
+ ///
+ ///
+ /// L2 regularization. Must be a scalar.
+ ///
+ ///
+ /// The change.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ApplyProximalGradientDescent'.
+ ///
+ ///
+ /// If True, the subtraction will be protected by a lock;
+ /// otherwise the behavior is undefined, but may exhibit less contention.
+ ///
+ ///
+ /// Same as "var".
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// prox_v = var - alpha * delta
+ /// var = sign(prox_v)/(1+alpha*l2) * max{|prox_v|-alpha*l1,0}
+ ///
+ public static Tensor apply_proximal_gradient_descent (Tensor var, Tensor alpha, Tensor l1, Tensor l2, Tensor delta, bool? use_locking = null, string name = "ApplyProximalGradientDescent")
+ {
+ var dict = new Dictionary();
+ dict["var"] = var;
+ dict["alpha"] = alpha;
+ dict["l1"] = l1;
+ dict["l2"] = l2;
+ dict["delta"] = delta;
+ if (use_locking.HasValue)
+ dict["use_locking"] = use_locking.Value;
+ var op = _op_def_lib._apply_op_helper("ApplyProximalGradientDescent", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Update '*var' according to the RMSProp algorithm.
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Should be from a Variable().
+ ///
+ ///
+ /// Scaling factor. Must be a scalar.
+ ///
+ ///
+ /// Decay rate. Must be a scalar.
+ ///
+ ///
+ ///
+ ///
+ /// Ridge term. Must be a scalar.
+ ///
+ ///
+ /// The gradient.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ApplyRMSProp'.
+ ///
+ ///
+ /// If True, updating of the var, ms, and mom tensors is protected
+ /// by a lock; otherwise the behavior is undefined, but may exhibit less
+ /// contention.
+ ///
+ ///
+ /// Same as "var".
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Note that in dense implementation of this algorithm, ms and mom will
+ /// update even if the grad is zero, but in this sparse implementation, ms
+ /// and mom will not update in iterations during which the grad is zero.
+ ///
+ /// mean_square = decay * mean_square + (1-decay) * gradient ** 2
+ /// Delta = learning_rate * gradient / sqrt(mean_square + epsilon)
+ ///
+ /// ms <- rho * ms_{t-1} + (1-rho) * grad * grad
+ /// mom <- momentum * mom_{t-1} + lr * grad / sqrt(ms + epsilon)
+ /// var <- var - mom
+ ///
+ public static Tensor apply_r_m_s_prop (Tensor var, Tensor ms, Tensor mom, Tensor lr, Tensor rho, Tensor momentum, Tensor epsilon, Tensor grad, bool? use_locking = null, string name = "ApplyRMSProp")
+ {
+ var dict = new Dictionary();
+ dict["var"] = var;
+ dict["ms"] = ms;
+ dict["mom"] = mom;
+ dict["lr"] = lr;
+ dict["rho"] = rho;
+ dict["momentum"] = momentum;
+ dict["epsilon"] = epsilon;
+ dict["grad"] = grad;
+ if (use_locking.HasValue)
+ dict["use_locking"] = use_locking.Value;
+ var op = _op_def_lib._apply_op_helper("ApplyRMSProp", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Returns the truth value of abs(x-y) < tolerance element-wise.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ApproximateEqual'.
+ ///
+ ///
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor approximate_equal (Tensor x, Tensor y, float? tolerance = null, string name = "ApproximateEqual")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ dict["y"] = y;
+ if (tolerance.HasValue)
+ dict["tolerance"] = tolerance.Value;
+ var op = _op_def_lib._apply_op_helper("ApproximateEqual", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Returns the index with the largest value across dimensions of a tensor.
+ ///
+ ///
+ ///
+ ///
+ /// int32 or int64, must be in the range [-rank(input), rank(input)).
+ /// Describes which dimension of the input Tensor to reduce across. For vectors,
+ /// use dimension = 0.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ArgMax'.
+ ///
+ ///
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Note that in case of ties the identity of the return value is not guaranteed.
+ ///
+ public static Tensor arg_max (Tensor input, Tensor dimension, TF_DataType? output_type = null, string name = "ArgMax")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["dimension"] = dimension;
+ if (output_type.HasValue)
+ dict["output_type"] = output_type.Value;
+ var op = _op_def_lib._apply_op_helper("ArgMax", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Returns the index with the smallest value across dimensions of a tensor.
+ ///
+ ///
+ ///
+ ///
+ /// int32 or int64, must be in the range [-rank(input), rank(input)).
+ /// Describes which dimension of the input Tensor to reduce across. For vectors,
+ /// use dimension = 0.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ArgMin'.
+ ///
+ ///
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Note that in case of ties the identity of the return value is not guaranteed.
+ ///
+ public static Tensor arg_min (Tensor input, Tensor dimension, TF_DataType? output_type = null, string name = "ArgMin")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["dimension"] = dimension;
+ if (output_type.HasValue)
+ dict["output_type"] = output_type.Value;
+ var op = _op_def_lib._apply_op_helper("ArgMin", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Converts each entry in the given tensor to strings. Supports many numeric
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AsString'.
+ ///
+ ///
+ /// The post-decimal precision to use for floating point numbers.
+ /// Only used if precision > -1.
+ ///
+ ///
+ /// Use scientific notation for floating point numbers.
+ ///
+ ///
+ /// Use shortest representation (either scientific or standard) for
+ /// floating point numbers.
+ ///
+ ///
+ /// Pad pre-decimal numbers to this width.
+ /// Applies to both floating point and integer numbers.
+ /// Only used if width > -1.
+ ///
+ ///
+ /// The value to pad if width > -1. If empty, pads with spaces.
+ /// Another typical value is '0'. String cannot be longer than 1 character.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// types and boolean.
+ ///
+ public static Tensor as_string (Tensor input, int? precision = null, bool? scientific = null, bool? shortest = null, int? width = null, string fill = null, string name = "AsString")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ if (precision.HasValue)
+ dict["precision"] = precision.Value;
+ if (scientific.HasValue)
+ dict["scientific"] = scientific.Value;
+ if (shortest.HasValue)
+ dict["shortest"] = shortest.Value;
+ if (width.HasValue)
+ dict["width"] = width.Value;
+ if (fill != null)
+ dict["fill"] = fill;
+ var op = _op_def_lib._apply_op_helper("AsString", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes asin of x element-wise.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Asin'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor asin (Tensor x, string name = "Asin")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ var op = _op_def_lib._apply_op_helper("Asin", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes inverse hyperbolic sine of x element-wise.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Asinh'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor asinh (Tensor x, string name = "Asinh")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ var op = _op_def_lib._apply_op_helper("Asinh", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Asserts that the given condition is true.
+ ///
+ ///
+ /// The condition to evaluate.
+ ///
+ ///
+ /// The tensors to print out when condition is false.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Assert'.
+ ///
+ ///
+ /// Print this many entries of each tensor.
+ ///
+ ///
+ /// Returns the description of the operation
+ ///
+ ///
+ /// If condition evaluates to false, print the list of tensors in data.
+ /// summarize determines how many entries of the tensors to print.
+ ///
+ public static Operation assert (Tensor condition, Tensor[] data, int? summarize = null, string name = "Assert")
+ {
+ var dict = new Dictionary();
+ dict["condition"] = condition;
+ dict["data"] = data;
+ if (summarize.HasValue)
+ dict["summarize"] = summarize.Value;
+ var op = _op_def_lib._apply_op_helper("Assert", name: name, keywords: dict);
+ return op;
+ }
+
+ ///
+ /// Update 'ref' by assigning 'value' to it.
+ ///
+ ///
+ /// Should be from a Variable node. May be uninitialized.
+ ///
+ ///
+ /// The value to be assigned to the variable.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Assign'.
+ ///
+ ///
+ /// If true, the operation will validate that the shape
+ /// of 'value' matches the shape of the Tensor being assigned to. If false,
+ /// 'ref' will take on the shape of 'value'.
+ ///
+ ///
+ /// If True, the assignment will be protected by a lock;
+ /// otherwise the behavior is undefined, but may exhibit less contention.
+ ///
+ ///
+ /// = Same as "ref". Returned as a convenience for operations that want
+ /// to use the new value after the variable has been reset.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// This operation outputs "ref" after the assignment is done.
+ /// This makes it easier to chain operations that need to use the reset value.
+ ///
+ public static Tensor assign (Tensor referecne, Tensor value, bool? validate_shape = null, bool? use_locking = null, string name = "Assign")
+ {
+ var dict = new Dictionary();
+ dict["ref"] = referecne;
+ dict["value"] = value;
+ if (validate_shape.HasValue)
+ dict["validate_shape"] = validate_shape.Value;
+ if (use_locking.HasValue)
+ dict["use_locking"] = use_locking.Value;
+ var op = _op_def_lib._apply_op_helper("Assign", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Update 'ref' by adding 'value' to it.
+ ///
+ ///
+ /// Should be from a Variable node.
+ ///
+ ///
+ /// The value to be added to the variable.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AssignAdd'.
+ ///
+ ///
+ /// If True, the addition will be protected by a lock;
+ /// otherwise the behavior is undefined, but may exhibit less contention.
+ ///
+ ///
+ /// = Same as "ref". Returned as a convenience for operations that want
+ /// to use the new value after the variable has been updated.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// This operation outputs "ref" after the update is done.
+ /// This makes it easier to chain operations that need to use the reset value.
+ ///
+ public static Tensor assign_add (Tensor referecne, Tensor value, bool? use_locking = null, string name = "AssignAdd")
+ {
+ var dict = new Dictionary();
+ dict["ref"] = referecne;
+ dict["value"] = value;
+ if (use_locking.HasValue)
+ dict["use_locking"] = use_locking.Value;
+ var op = _op_def_lib._apply_op_helper("AssignAdd", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Adds a value to the current value of a variable.
+ ///
+ ///
+ /// handle to the resource in which to store the variable.
+ ///
+ ///
+ /// the value by which the variable will be incremented.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AssignAddVariableOp'.
+ ///
+ ///
+ /// Returns the description of the operation
+ ///
+ ///
+ /// Any ReadVariableOp with a control dependency on this op is guaranteed to
+ /// see the incremented value or a subsequent newer one.
+ ///
+ public static Operation assign_add_variable_op (Tensor resource, Tensor value, string name = "AssignAddVariableOp")
+ {
+ var dict = new Dictionary();
+ dict["resource"] = resource;
+ dict["value"] = value;
+ var op = _op_def_lib._apply_op_helper("AssignAddVariableOp", name: name, keywords: dict);
+ return op;
+ }
+
+ ///
+ /// Update 'ref' by subtracting 'value' from it.
+ ///
+ ///
+ /// Should be from a Variable node.
+ ///
+ ///
+ /// The value to be subtracted to the variable.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AssignSub'.
+ ///
+ ///
+ /// If True, the subtraction will be protected by a lock;
+ /// otherwise the behavior is undefined, but may exhibit less contention.
+ ///
+ ///
+ /// = Same as "ref". Returned as a convenience for operations that want
+ /// to use the new value after the variable has been updated.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// This operation outputs "ref" after the update is done.
+ /// This makes it easier to chain operations that need to use the reset value.
+ ///
+ public static Tensor assign_sub (Tensor referecne, Tensor value, bool? use_locking = null, string name = "AssignSub")
+ {
+ var dict = new Dictionary();
+ dict["ref"] = referecne;
+ dict["value"] = value;
+ if (use_locking.HasValue)
+ dict["use_locking"] = use_locking.Value;
+ var op = _op_def_lib._apply_op_helper("AssignSub", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Subtracts a value from the current value of a variable.
+ ///
+ ///
+ /// handle to the resource in which to store the variable.
+ ///
+ ///
+ /// the value by which the variable will be incremented.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AssignSubVariableOp'.
+ ///
+ ///
+ /// Returns the description of the operation
+ ///
+ ///
+ /// Any ReadVariableOp with a control dependency on this op is guaranteed to
+ /// see the decremented value or a subsequent newer one.
+ ///
+ public static Operation assign_sub_variable_op (Tensor resource, Tensor value, string name = "AssignSubVariableOp")
+ {
+ var dict = new Dictionary();
+ dict["resource"] = resource;
+ dict["value"] = value;
+ var op = _op_def_lib._apply_op_helper("AssignSubVariableOp", name: name, keywords: dict);
+ return op;
+ }
+
+ ///
+ /// Assigns a new value to a variable.
+ ///
+ ///
+ /// handle to the resource in which to store the variable.
+ ///
+ ///
+ /// the value to set the new tensor to use.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AssignVariableOp'.
+ ///
+ ///
+ /// Returns the description of the operation
+ ///
+ ///
+ /// Any ReadVariableOp with a control dependency on this op is guaranteed to return
+ /// this value or a subsequent newer value of the variable.
+ ///
+ public static Operation assign_variable_op (Tensor resource, Tensor value, string name = "AssignVariableOp")
+ {
+ var dict = new Dictionary();
+ dict["resource"] = resource;
+ dict["value"] = value;
+ var op = _op_def_lib._apply_op_helper("AssignVariableOp", name: name, keywords: dict);
+ return op;
+ }
+
+ ///
+ /// Computes atan of x element-wise.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Atan'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor atan (Tensor x, string name = "Atan")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ var op = _op_def_lib._apply_op_helper("Atan", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes arctangent of y/x element-wise, respecting signs of the arguments.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Atan2'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// This is the angle \( \theta \in [-\pi, \pi] \) such that
+ /// \[ x = r \cos(\theta) \]
+ /// and
+ /// \[ y = r \sin(\theta) \]
+ /// where \(r = \sqrt(x^2 + y^2) \).
+ ///
+ public static Tensor atan2 (Tensor y, Tensor x, string name = "Atan2")
+ {
+ var dict = new Dictionary();
+ dict["y"] = y;
+ dict["x"] = x;
+ var op = _op_def_lib._apply_op_helper("Atan2", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes inverse hyperbolic tangent of x element-wise.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Atanh'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor atanh (Tensor x, string name = "Atanh")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ var op = _op_def_lib._apply_op_helper("Atanh", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Produces a visualization of audio data over time.
+ ///
+ ///
+ /// Float representation of audio data.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AudioSpectrogram'.
+ ///
+ ///
+ /// Optional argument
+ /// How wide the input window is in samples. For the highest efficiency
+ /// this should be a power of two, but other values are accepted.
+ ///
+ ///
+ /// Optional argument
+ /// How widely apart the center of adjacent sample windows should be.
+ ///
+ ///
+ /// Whether to return the squared magnitude or just the
+ /// magnitude. Using squared magnitude can avoid extra calculations.
+ ///
+ ///
+ /// 3D representation of the audio frequencies as an image.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Spectrograms are a standard way of representing audio information as a series of
+ /// slices of frequency information, one slice for each window of time. By joining
+ /// these together into a sequence, they form a distinctive fingerprint of the sound
+ /// over time.
+ ///
+ /// This op expects to receive audio data as an input, stored as floats in the range
+ /// -1 to 1, together with a window width in samples, and a stride specifying how
+ /// far to move the window between slices. From this it generates a three
+ /// dimensional output. The lowest dimension has an amplitude value for each
+ /// frequency during that time slice. The next dimension is time, with successive
+ /// frequency slices. The final dimension is for the channels in the input, so a
+ /// stereo audio input would have two here for example.
+ ///
+ /// This means the layout when converted and saved as an image is rotated 90 degrees
+ /// clockwise from a typical spectrogram. Time is descending down the Y axis, and
+ /// the frequency decreases from left to right.
+ ///
+ /// Each value in the result represents the square root of the sum of the real and
+ /// imaginary parts of an FFT on the current window of samples. In this way, the
+ /// lowest dimension represents the power of each frequency in the current window,
+ /// and adjacent windows are concatenated in the next dimension.
+ ///
+ /// To get a more intuitive and visual look at what this operation does, you can run
+ /// tensorflow/examples/wav_to_spectrogram to read in an audio file and save out the
+ /// resulting spectrogram as a PNG image.
+ ///
+ public static Tensor audio_spectrogram (Tensor input, int window_size, int stride, bool? magnitude_squared = null, string name = "AudioSpectrogram")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["window_size"] = window_size;
+ dict["stride"] = stride;
+ if (magnitude_squared.HasValue)
+ dict["magnitude_squared"] = magnitude_squared.Value;
+ var op = _op_def_lib._apply_op_helper("AudioSpectrogram", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Outputs a Summary protocol buffer with audio.
+ ///
+ ///
+ /// Scalar. Used to build the tag attribute of the summary values.
+ ///
+ ///
+ /// 2-D of shape [batch_size, frames].
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AudioSummary'.
+ ///
+ ///
+ /// Optional argument
+ /// The sample rate of the signal in hertz.
+ ///
+ ///
+ /// Max number of batch elements to generate audio for.
+ ///
+ ///
+ /// Scalar. Serialized Summary protocol buffer.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// The summary has up to max_outputs summary values containing audio. The
+ /// audio is built from tensor which must be 3-D with shape [batch_size,
+ /// frames, channels] or 2-D with shape [batch_size, frames]. The values are
+ /// assumed to be in the range of [-1.0, 1.0] with a sample rate of sample_rate.
+ ///
+ /// The tag argument is a scalar Tensor of type string. It is used to
+ /// build the tag of the summary values:
+ ///
+ /// * If max_outputs is 1, the summary value tag is '*tag*/audio'.
+ /// * If max_outputs is greater than 1, the summary value tags are
+ /// generated sequentially as '*tag*/audio/0', '*tag*/audio/1', etc.
+ ///
+ public static Tensor audio_summary (Tensor tag, Tensor tensor, float sample_rate, int? max_outputs = null, string name = "AudioSummary")
+ {
+ var dict = new Dictionary();
+ dict["tag"] = tag;
+ dict["tensor"] = tensor;
+ dict["sample_rate"] = sample_rate;
+ if (max_outputs.HasValue)
+ dict["max_outputs"] = max_outputs.Value;
+ var op = _op_def_lib._apply_op_helper("AudioSummary", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Outputs a Summary protocol buffer with audio.
+ ///
+ ///
+ /// Scalar. Used to build the tag attribute of the summary values.
+ ///
+ ///
+ /// 2-D of shape [batch_size, frames].
+ ///
+ ///
+ /// The sample rate of the signal in hertz.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AudioSummaryV2'.
+ ///
+ ///
+ /// Max number of batch elements to generate audio for.
+ ///
+ ///
+ /// Scalar. Serialized Summary protocol buffer.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// The summary has up to max_outputs summary values containing audio. The
+ /// audio is built from tensor which must be 3-D with shape [batch_size,
+ /// frames, channels] or 2-D with shape [batch_size, frames]. The values are
+ /// assumed to be in the range of [-1.0, 1.0] with a sample rate of sample_rate.
+ ///
+ /// The tag argument is a scalar Tensor of type string. It is used to
+ /// build the tag of the summary values:
+ ///
+ /// * If max_outputs is 1, the summary value tag is '*tag*/audio'.
+ /// * If max_outputs is greater than 1, the summary value tags are
+ /// generated sequentially as '*tag*/audio/0', '*tag*/audio/1', etc.
+ ///
+ public static Tensor audio_summary_v2 (Tensor tag, Tensor tensor, Tensor sample_rate, int? max_outputs = null, string name = "AudioSummaryV2")
+ {
+ var dict = new Dictionary();
+ dict["tag"] = tag;
+ dict["tensor"] = tensor;
+ dict["sample_rate"] = sample_rate;
+ if (max_outputs.HasValue)
+ dict["max_outputs"] = max_outputs.Value;
+ var op = _op_def_lib._apply_op_helper("AudioSummaryV2", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Performs average pooling on the input.
+ ///
+ ///
+ /// 4-D with shape [batch, height, width, channels].
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AvgPool'.
+ ///
+ ///
+ /// Optional argument
+ /// The size of the sliding window for each dimension of value.
+ ///
+ ///
+ /// Optional argument
+ /// The stride of the sliding window for each dimension of value.
+ ///
+ ///
+ /// Optional argument
+ /// The type of padding algorithm to use.
+ ///
+ ///
+ /// Specify the data format of the input and output data. With the
+ /// default format "NHWC", the data is stored in the order of:
+ /// [batch, in_height, in_width, in_channels].
+ /// Alternatively, the format could be "NCHW", the data storage order of:
+ /// [batch, in_channels, in_height, in_width].
+ ///
+ ///
+ /// The average pooled output tensor.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Each entry in output is the mean of the corresponding size ksize
+ /// window in value.
+ ///
+ public static Tensor avg_pool (Tensor value, int[] ksize, int[] strides, string padding, string data_format = null, string name = "AvgPool")
+ {
+ var dict = new Dictionary();
+ dict["value"] = value;
+ dict["ksize"] = ksize;
+ dict["strides"] = strides;
+ dict["padding"] = padding;
+ if (data_format != null)
+ dict["data_format"] = data_format;
+ var op = _op_def_lib._apply_op_helper("AvgPool", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Performs 3D average pooling on the input.
+ ///
+ ///
+ /// Shape [batch, depth, rows, cols, channels] tensor to pool over.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AvgPool3D'.
+ ///
+ ///
+ /// Optional argument
+ /// 1-D tensor of length 5. The size of the window for each dimension of
+ /// the input tensor. Must have ksize[0] = ksize[4] = 1.
+ ///
+ ///
+ /// Optional argument
+ /// 1-D tensor of length 5. The stride of the sliding window for each
+ /// dimension of input. Must have strides[0] = strides[4] = 1.
+ ///
+ ///
+ /// Optional argument
+ /// The type of padding algorithm to use.
+ ///
+ ///
+ /// The data format of the input and output data. With the
+ /// default format "NDHWC", the data is stored in the order of:
+ /// [batch, in_depth, in_height, in_width, in_channels].
+ /// Alternatively, the format could be "NCDHW", the data storage order is:
+ /// [batch, in_channels, in_depth, in_height, in_width].
+ ///
+ ///
+ /// The average pooled output tensor.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor avg_pool3d (Tensor input, int[] ksize, int[] strides, string padding, string data_format = null, string name = "AvgPool3D")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["ksize"] = ksize;
+ dict["strides"] = strides;
+ dict["padding"] = padding;
+ if (data_format != null)
+ dict["data_format"] = data_format;
+ var op = _op_def_lib._apply_op_helper("AvgPool3D", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes gradients of average pooling function.
+ ///
+ ///
+ /// The original input dimensions.
+ ///
+ ///
+ /// Output backprop of shape [batch, depth, rows, cols, channels].
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AvgPool3DGrad'.
+ ///
+ ///
+ /// Optional argument
+ /// 1-D tensor of length 5. The size of the window for each dimension of
+ /// the input tensor. Must have ksize[0] = ksize[4] = 1.
+ ///
+ ///
+ /// Optional argument
+ /// 1-D tensor of length 5. The stride of the sliding window for each
+ /// dimension of input. Must have strides[0] = strides[4] = 1.
+ ///
+ ///
+ /// Optional argument
+ /// The type of padding algorithm to use.
+ ///
+ ///
+ /// The data format of the input and output data. With the
+ /// default format "NDHWC", the data is stored in the order of:
+ /// [batch, in_depth, in_height, in_width, in_channels].
+ /// Alternatively, the format could be "NCDHW", the data storage order is:
+ /// [batch, in_channels, in_depth, in_height, in_width].
+ ///
+ ///
+ /// The backprop for input.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor avg_pool3d_grad (Tensor orig_input_shape, Tensor grad, int[] ksize, int[] strides, string padding, string data_format = null, string name = "AvgPool3DGrad")
+ {
+ var dict = new Dictionary();
+ dict["orig_input_shape"] = orig_input_shape;
+ dict["grad"] = grad;
+ dict["ksize"] = ksize;
+ dict["strides"] = strides;
+ dict["padding"] = padding;
+ if (data_format != null)
+ dict["data_format"] = data_format;
+ var op = _op_def_lib._apply_op_helper("AvgPool3DGrad", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes gradients of the average pooling function.
+ ///
+ ///
+ /// 1-D. Shape of the original input to avg_pool.
+ ///
+ ///
+ /// 4-D with shape [batch, height, width, channels]. Gradients w.r.t.
+ /// the output of avg_pool.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AvgPoolGrad'.
+ ///
+ ///
+ /// Optional argument
+ /// The size of the sliding window for each dimension of the input.
+ ///
+ ///
+ /// Optional argument
+ /// The stride of the sliding window for each dimension of the input.
+ ///
+ ///
+ /// Optional argument
+ /// The type of padding algorithm to use.
+ ///
+ ///
+ /// Specify the data format of the input and output data. With the
+ /// default format "NHWC", the data is stored in the order of:
+ /// [batch, in_height, in_width, in_channels].
+ /// Alternatively, the format could be "NCHW", the data storage order of:
+ /// [batch, in_channels, in_height, in_width].
+ ///
+ ///
+ /// 4-D. Gradients w.r.t. the input of avg_pool.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor avg_pool_grad (Tensor orig_input_shape, Tensor grad, int[] ksize, int[] strides, string padding, string data_format = null, string name = "AvgPoolGrad")
+ {
+ var dict = new Dictionary();
+ dict["orig_input_shape"] = orig_input_shape;
+ dict["grad"] = grad;
+ dict["ksize"] = ksize;
+ dict["strides"] = strides;
+ dict["padding"] = padding;
+ if (data_format != null)
+ dict["data_format"] = data_format;
+ var op = _op_def_lib._apply_op_helper("AvgPoolGrad", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Defines a barrier that persists across different graph executions.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Barrier'.
+ ///
+ ///
+ /// Optional argument
+ /// The type of each component in a value.
+ ///
+ ///
+ /// The shape of each component in a value. Each shape must be 1 in the
+ /// first dimension. The length of this attr must be the same as the length of
+ /// component_types.
+ ///
+ ///
+ /// The capacity of the barrier. The default capacity is MAX_INT32,
+ /// which is the largest capacity of the underlying queue.
+ ///
+ ///
+ /// If non-empty, this barrier is placed in the given container.
+ /// Otherwise, a default container is used.
+ ///
+ ///
+ /// If non-empty, this barrier will be shared under the given name
+ /// across multiple sessions.
+ ///
+ ///
+ /// The handle to the barrier.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// A barrier represents a key-value map, where each key is a string, and
+ /// each value is a tuple of tensors.
+ ///
+ /// At runtime, the barrier contains 'complete' and 'incomplete'
+ /// elements. A complete element has defined tensors for all components of
+ /// its value tuple, and may be accessed using BarrierTakeMany. An
+ /// incomplete element has some undefined components in its value tuple,
+ /// and may be updated using BarrierInsertMany.
+ ///
+ public static Tensor barrier (TF_DataType[] component_types, TensorShape[] shapes = null, int? capacity = null, string container = null, string shared_name = null, string name = "Barrier")
+ {
+ var dict = new Dictionary();
+ dict["component_types"] = component_types;
+ if (shapes != null)
+ dict["shapes"] = shapes;
+ if (capacity.HasValue)
+ dict["capacity"] = capacity.Value;
+ if (container != null)
+ dict["container"] = container;
+ if (shared_name != null)
+ dict["shared_name"] = shared_name;
+ var op = _op_def_lib._apply_op_helper("Barrier", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Closes the given barrier.
+ ///
+ ///
+ /// The handle to a barrier.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BarrierClose'.
+ ///
+ ///
+ /// If true, all pending enqueue requests that are
+ /// blocked on the barrier's queue will be canceled. InsertMany will fail, even
+ /// if no new key is introduced.
+ ///
+ ///
+ /// Returns the description of the operation
+ ///
+ ///
+ /// This operation signals that no more new elements will be inserted in the
+ /// given barrier. Subsequent InsertMany that try to introduce a new key will fail.
+ /// Subsequent InsertMany operations that just add missing components to already
+ /// existing elements will continue to succeed. Subsequent TakeMany operations will
+ /// continue to succeed if sufficient completed elements remain in the barrier.
+ /// Subsequent TakeMany operations that would block will fail immediately.
+ ///
+ public static Operation barrier_close (Tensor handle, bool? cancel_pending_enqueues = null, string name = "BarrierClose")
+ {
+ var dict = new Dictionary();
+ dict["handle"] = handle;
+ if (cancel_pending_enqueues.HasValue)
+ dict["cancel_pending_enqueues"] = cancel_pending_enqueues.Value;
+ var op = _op_def_lib._apply_op_helper("BarrierClose", name: name, keywords: dict);
+ return op;
+ }
+
+ ///
+ /// Computes the number of incomplete elements in the given barrier.
+ ///
+ ///
+ /// The handle to a barrier.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BarrierIncompleteSize'.
+ ///
+ ///
+ /// The number of incomplete elements (i.e. those with some of their value
+ /// components not set) in the barrier.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor barrier_incomplete_size (Tensor handle, string name = "BarrierIncompleteSize")
+ {
+ var dict = new Dictionary();
+ dict["handle"] = handle;
+ var op = _op_def_lib._apply_op_helper("BarrierIncompleteSize", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// For each key, assigns the respective value to the specified component.
+ ///
+ ///
+ /// The handle to a barrier.
+ ///
+ ///
+ /// A one-dimensional tensor of keys, with length n.
+ ///
+ ///
+ /// An any-dimensional tensor of values, which are associated with the
+ /// respective keys. The 0th dimension must have length n.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BarrierInsertMany'.
+ ///
+ ///
+ /// Optional argument
+ /// The component of the barrier elements that is being assigned.
+ ///
+ ///
+ /// Returns the description of the operation
+ ///
+ ///
+ /// If a key is not found in the barrier, this operation will create a new
+ /// incomplete element. If a key is found in the barrier, and the element
+ /// already has a value at component_index, this operation will fail with
+ /// INVALID_ARGUMENT, and leave the barrier in an undefined state.
+ ///
+ public static Operation barrier_insert_many (Tensor handle, Tensor keys, Tensor values, int component_index, string name = "BarrierInsertMany")
+ {
+ var dict = new Dictionary();
+ dict["handle"] = handle;
+ dict["keys"] = keys;
+ dict["values"] = values;
+ dict["component_index"] = component_index;
+ var op = _op_def_lib._apply_op_helper("BarrierInsertMany", name: name, keywords: dict);
+ return op;
+ }
+
+ ///
+ /// Computes the number of complete elements in the given barrier.
+ ///
+ ///
+ /// The handle to a barrier.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BarrierReadySize'.
+ ///
+ ///
+ /// The number of complete elements (i.e. those with all of their value
+ /// components set) in the barrier.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor barrier_ready_size (Tensor handle, string name = "BarrierReadySize")
+ {
+ var dict = new Dictionary();
+ dict["handle"] = handle;
+ var op = _op_def_lib._apply_op_helper("BarrierReadySize", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Takes the given number of completed elements from a barrier.
+ ///
+ ///
+ /// The handle to a barrier.
+ ///
+ ///
+ /// A single-element tensor containing the number of elements to
+ /// take.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BarrierTakeMany'.
+ ///
+ ///
+ /// Optional argument
+ /// The type of each component in a value.
+ ///
+ ///
+ /// Allow to return less than num_elements items if barrier is
+ /// already closed.
+ ///
+ ///
+ ///
+ ///
+ /// If the queue is empty, this operation will block for up to
+ /// timeout_ms milliseconds.
+ /// Note: This option is not supported yet.
+ ///
+ ///
+ /// Returns a tuple with multiple values, as follows:
+ /// indices : A one-dimensional tensor of indices, with length num_elems.
+ /// These indices refer to the batch in which the values were placed into the
+ /// barrier (starting with MIN_LONG and increasing with each BarrierInsertMany).
+ /// keys : A one-dimensional tensor of keys, with length num_elements.
+ /// values : One any-dimensional tensor per component in a barrier element. All
+ /// values have length num_elements in the 0th dimension.
+ /// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
+ ///
+ ///
+ /// This operation concatenates completed-element component tensors along
+ /// the 0th dimension to make a single component tensor.
+ ///
+ /// Elements come out of the barrier when they are complete, and in the order
+ /// in which they were placed into the barrier. The indices output provides
+ /// information about the batch in which each element was originally inserted
+ /// into the barrier.
+ ///
+ public static (Tensor indices, Tensor keys, Tensor[] values) barrier_take_many (Tensor handle, Tensor num_elements, TF_DataType[] component_types, bool? allow_small_batch = null, bool? wait_for_incomplete = null, int? timeout_ms = null, string name = "BarrierTakeMany")
+ {
+ var dict = new Dictionary();
+ dict["handle"] = handle;
+ dict["num_elements"] = num_elements;
+ dict["component_types"] = component_types;
+ if (allow_small_batch.HasValue)
+ dict["allow_small_batch"] = allow_small_batch.Value;
+ if (wait_for_incomplete.HasValue)
+ dict["wait_for_incomplete"] = wait_for_incomplete.Value;
+ if (timeout_ms.HasValue)
+ dict["timeout_ms"] = timeout_ms.Value;
+ var op = _op_def_lib._apply_op_helper("BarrierTakeMany", name: name, keywords: dict);
+ int _idx = 0;
+ var indices = op.outputs[_idx++];
+ var keys = op.outputs[_idx++];
+ var values = Enumerable.Range(0, op.OutputListLength("values")).Select(_ => op.outputs[_idx++]).ToArray();
+ return (indices, keys, values);
+ }
+
+ ///
+ /// Batches all input tensors nondeterministically.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Batch'.
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Returns a tuple with multiple values, as follows:
+ /// batched_tensors :
+ /// batch_index :
+ /// id :
+ /// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
+ ///
+ ///
+ /// When many instances of this Op are being run concurrently with the same
+ /// container/shared_name in the same device, some will output zero-shaped Tensors
+ /// and others will output Tensors of size up to max_batch_size.
+ ///
+ /// All Tensors in in_tensors are batched together (so, for example, labels and
+ /// features should be batched with a single instance of this operation.
+ ///
+ /// Each invocation of batch emits an id scalar which will be used to identify
+ /// this particular invocation when doing unbatch or its gradient.
+ ///
+ /// Each op which emits a non-empty batch will also emit a non-empty batch_index
+ /// Tensor, which, is a [K, 3] matrix where each row contains the invocation's id,
+ /// start, and length of elements of each set of Tensors present in batched_tensors.
+ ///
+ /// Batched tensors are concatenated along the first dimension, and all tensors in
+ /// in_tensors must have the first dimension of the same size.
+ ///
+ /// in_tensors: The tensors to be batched.
+ /// num_batch_threads: Number of scheduling threads for processing batches of work.
+ /// Determines the number of batches processed in parallel.
+ /// max_batch_size: Batch sizes will never be bigger than this.
+ /// batch_timeout_micros: Maximum number of microseconds to wait before outputting
+ /// an incomplete batch.
+ /// allowed_batch_sizes: Optional list of allowed batch sizes. If left empty, does
+ /// nothing. Otherwise, supplies a list of batch sizes, causing the op to pad
+ /// batches up to one of those sizes. The entries must increase monotonically, and
+ /// the final entry must equal max_batch_size.
+ /// grad_timeout_micros: The timeout to use for the gradient. See Unbatch.
+ /// batched_tensors: Either empty tensors or a batch of concatenated Tensors.
+ /// batch_index: If out_tensors is non-empty, has information to invert it.
+ /// container: Controls the scope of sharing of this batch.
+ /// id: always contains a scalar with a unique ID for this invocation of Batch.
+ /// shared_name: Concurrently running instances of batch in the same device with the
+ /// same container and shared_name will batch their elements together. If left
+ /// empty, the op name will be used as the shared name.
+ /// T: the types of tensors to be batched.
+ ///
+ public static (Tensor[] batched_tensors, Tensor batch_index, Tensor id) batch (Tensor[] in_tensors, int num_batch_threads, int max_batch_size, int batch_timeout_micros, int grad_timeout_micros, int? max_enqueued_batches = null, int[] allowed_batch_sizes = null, string container = null, string shared_name = null, string batching_queue = null, string name = "Batch")
+ {
+ var dict = new Dictionary();
+ dict["in_tensors"] = in_tensors;
+ dict["num_batch_threads"] = num_batch_threads;
+ dict["max_batch_size"] = max_batch_size;
+ dict["batch_timeout_micros"] = batch_timeout_micros;
+ dict["grad_timeout_micros"] = grad_timeout_micros;
+ if (max_enqueued_batches.HasValue)
+ dict["max_enqueued_batches"] = max_enqueued_batches.Value;
+ if (allowed_batch_sizes != null)
+ dict["allowed_batch_sizes"] = allowed_batch_sizes;
+ if (container != null)
+ dict["container"] = container;
+ if (shared_name != null)
+ dict["shared_name"] = shared_name;
+ if (batching_queue != null)
+ dict["batching_queue"] = batching_queue;
+ var op = _op_def_lib._apply_op_helper("Batch", name: name, keywords: dict);
+ int _idx = 0;
+ var batched_tensors = Enumerable.Range(0, op.OutputListLength("batched_tensors")).Select(_ => op.outputs[_idx++]).ToArray();
+ var batch_index = op.outputs[_idx++];
+ var id = op.outputs[_idx++];
+ return (batched_tensors, batch_index, id);
+ }
+
+ ///
+ /// Creates a dataset that batches batch_size elements from input_dataset.
+ ///
+ ///
+ ///
+ ///
+ /// A scalar representing the number of elements to accumulate in a
+ /// batch.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BatchDataset'.
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor batch_dataset (Tensor input_dataset, Tensor batch_size, TF_DataType[] output_types, TensorShape[] output_shapes, string name = "BatchDataset")
+ {
+ var dict = new Dictionary();
+ dict["input_dataset"] = input_dataset;
+ dict["batch_size"] = batch_size;
+ dict["output_types"] = output_types;
+ dict["output_shapes"] = output_shapes;
+ var op = _op_def_lib._apply_op_helper("BatchDataset", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Creates a dataset that batches batch_size elements from input_dataset.
+ ///
+ ///
+ ///
+ ///
+ /// A scalar representing the number of elements to accumulate in a batch.
+ ///
+ ///
+ /// A scalar representing whether the last batch should be dropped in case its size
+ /// is smaller than desired.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BatchDatasetV2'.
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor batch_dataset_v2 (Tensor input_dataset, Tensor batch_size, Tensor drop_remainder, TF_DataType[] output_types, TensorShape[] output_shapes, string name = "BatchDatasetV2")
+ {
+ var dict = new Dictionary();
+ dict["input_dataset"] = input_dataset;
+ dict["batch_size"] = batch_size;
+ dict["drop_remainder"] = drop_remainder;
+ dict["output_types"] = output_types;
+ dict["output_shapes"] = output_shapes;
+ var op = _op_def_lib._apply_op_helper("BatchDatasetV2", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Multiplies slices of two tensors in batches.
+ ///
+ ///
+ /// 2-D or higher with shape [..., r_x, c_x].
+ ///
+ ///
+ /// 2-D or higher with shape [..., r_y, c_y].
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BatchMatMul'.
+ ///
+ ///
+ /// If True, adjoint the slices of x. Defaults to False.
+ ///
+ ///
+ /// If True, adjoint the slices of y. Defaults to False.
+ ///
+ ///
+ /// 3-D or higher with shape [..., r_o, c_o]
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Multiplies all slices of Tensor x and y (each slice can be
+ /// viewed as an element of a batch), and arranges the individual results
+ /// in a single output tensor of the same batch size. Each of the
+ /// individual slices can optionally be adjointed (to adjoint a matrix
+ /// means to transpose and conjugate it) before multiplication by setting
+ /// the adj_x or adj_y flag to True, which are by default False.
+ ///
+ /// The input tensors x and y are 2-D or higher with shape [..., r_x, c_x]
+ /// and [..., r_y, c_y].
+ ///
+ /// The output tensor is 2-D or higher with shape [..., r_o, c_o], where:
+ ///
+ /// r_o = c_x if adj_x else r_x
+ /// c_o = r_y if adj_y else c_y
+ ///
+ /// It is computed as:
+ ///
+ /// output[..., :, :] = matrix(x[..., :, :]) * matrix(y[..., :, :])
+ ///
+ public static Tensor batch_mat_mul (Tensor x, Tensor y, bool? adj_x = null, bool? adj_y = null, string name = "BatchMatMul")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ dict["y"] = y;
+ if (adj_x.HasValue)
+ dict["adj_x"] = adj_x.Value;
+ if (adj_y.HasValue)
+ dict["adj_y"] = adj_y.Value;
+ var op = _op_def_lib._apply_op_helper("BatchMatMul", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Batch normalization.
+ ///
+ ///
+ /// A 4D input Tensor.
+ ///
+ ///
+ /// A 1D mean Tensor with size matching the last dimension of t.
+ /// This is the first output from tf.nn.moments,
+ /// or a saved moving average thereof.
+ ///
+ ///
+ /// A 1D variance Tensor with size matching the last dimension of t.
+ /// This is the second output from tf.nn.moments,
+ /// or a saved moving average thereof.
+ ///
+ ///
+ /// A 1D beta Tensor with size matching the last dimension of t.
+ /// An offset to be added to the normalized tensor.
+ ///
+ ///
+ /// A 1D gamma Tensor with size matching the last dimension of t.
+ /// If "scale_after_normalization" is true, this tensor will be multiplied
+ /// with the normalized tensor.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BatchNormWithGlobalNormalization'.
+ ///
+ ///
+ /// Optional argument
+ /// A small float number to avoid dividing by 0.
+ ///
+ ///
+ /// Optional argument
+ /// A bool indicating whether the resulted tensor
+ /// needs to be multiplied with gamma.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// This op is deprecated. Prefer tf.nn.batch_normalization.
+ ///
+ public static Tensor batch_norm_with_global_normalization (Tensor t, Tensor m, Tensor v, Tensor beta, Tensor gamma, float variance_epsilon, bool scale_after_normalization, string name = "BatchNormWithGlobalNormalization")
+ {
+ var dict = new Dictionary();
+ dict["t"] = t;
+ dict["m"] = m;
+ dict["v"] = v;
+ dict["beta"] = beta;
+ dict["gamma"] = gamma;
+ dict["variance_epsilon"] = variance_epsilon;
+ dict["scale_after_normalization"] = scale_after_normalization;
+ var op = _op_def_lib._apply_op_helper("BatchNormWithGlobalNormalization", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Gradients for batch normalization.
+ ///
+ ///
+ /// A 4D input Tensor.
+ ///
+ ///
+ /// A 1D mean Tensor with size matching the last dimension of t.
+ /// This is the first output from tf.nn.moments,
+ /// or a saved moving average thereof.
+ ///
+ ///
+ /// A 1D variance Tensor with size matching the last dimension of t.
+ /// This is the second output from tf.nn.moments,
+ /// or a saved moving average thereof.
+ ///
+ ///
+ /// A 1D gamma Tensor with size matching the last dimension of t.
+ /// If "scale_after_normalization" is true, this Tensor will be multiplied
+ /// with the normalized Tensor.
+ ///
+ ///
+ /// 4D backprop Tensor.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BatchNormWithGlobalNormalizationGrad'.
+ ///
+ ///
+ /// Optional argument
+ /// A small float number to avoid dividing by 0.
+ ///
+ ///
+ /// Optional argument
+ /// A bool indicating whether the resulted tensor
+ /// needs to be multiplied with gamma.
+ ///
+ ///
+ /// Returns a tuple with multiple values, as follows:
+ /// dx : 4D backprop tensor for input.
+ /// dm : 1D backprop tensor for mean.
+ /// dv : 1D backprop tensor for variance.
+ /// db : 1D backprop tensor for beta.
+ /// dg : 1D backprop tensor for gamma.
+ /// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
+ ///
+ ///
+ /// This op is deprecated. See tf.nn.batch_normalization.
+ ///
+ public static (Tensor dx, Tensor dm, Tensor dv, Tensor db, Tensor dg) batch_norm_with_global_normalization_grad (Tensor t, Tensor m, Tensor v, Tensor gamma, Tensor backprop, float variance_epsilon, bool scale_after_normalization, string name = "BatchNormWithGlobalNormalizationGrad")
+ {
+ var dict = new Dictionary();
+ dict["t"] = t;
+ dict["m"] = m;
+ dict["v"] = v;
+ dict["gamma"] = gamma;
+ dict["backprop"] = backprop;
+ dict["variance_epsilon"] = variance_epsilon;
+ dict["scale_after_normalization"] = scale_after_normalization;
+ var op = _op_def_lib._apply_op_helper("BatchNormWithGlobalNormalizationGrad", name: name, keywords: dict);
+ int _idx = 0;
+ var dx = op.outputs[_idx++];
+ var dm = op.outputs[_idx++];
+ var dv = op.outputs[_idx++];
+ var db = op.outputs[_idx++];
+ var dg = op.outputs[_idx++];
+ return (dx, dm, dv, db, dg);
+ }
+
+ ///
+ /// BatchToSpace for 4-D tensors of type T.
+ ///
+ ///
+ /// 4-D tensor with shape
+ /// [batch*block_size*block_size, height_pad/block_size, width_pad/block_size,
+ /// depth]. Note that the batch size of the input tensor must be divisible by
+ /// block_size * block_size.
+ ///
+ ///
+ /// 2-D tensor of non-negative integers with shape [2, 2]. It specifies
+ /// how many elements to crop from the intermediate result across the spatial
+ /// dimensions as follows:
+ ///
+ /// crops = [[crop_top, crop_bottom], [crop_left, crop_right]]
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BatchToSpace'.
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// 4-D with shape [batch, height, width, depth], where:
+ ///
+ /// height = height_pad - crop_top - crop_bottom
+ /// width = width_pad - crop_left - crop_right
+ ///
+ /// The attr block_size must be greater than one. It indicates the block size.
+ ///
+ /// Some examples:
+ ///
+ /// (1) For the following input of shape [4, 1, 1, 1] and block_size of 2:
+ ///
+ ///
+ /// [[[[1]]], [[[2]]], [[[3]]], [[[4]]]]
+ ///
+ ///
+ /// The output tensor has shape [1, 2, 2, 1] and value:
+ ///
+ ///
+ /// x = [[[[1], [2]], [[3], [4]]]]
+ ///
+ ///
+ /// (2) For the following input of shape [4, 1, 1, 3] and block_size of 2:
+ ///
+ ///
+ /// [[[1, 2, 3]], [[4, 5, 6]], [[7, 8, 9]], [[10, 11, 12]]]
+ ///
+ ///
+ /// The output tensor has shape [1, 2, 2, 3] and value:
+ ///
+ ///
+ /// x = [[[[1, 2, 3], [4, 5, 6]],
+ /// [[7, 8, 9], [10, 11, 12]]]]
+ ///
+ ///
+ /// (3) For the following input of shape [4, 2, 2, 1] and block_size of 2:
+ ///
+ ///
+ /// x = [[[[1], [3]], [[9], [11]]],
+ /// [[[2], [4]], [[10], [12]]],
+ /// [[[5], [7]], [[13], [15]]],
+ /// [[[6], [8]], [[14], [16]]]]
+ ///
+ ///
+ /// The output tensor has shape [1, 4, 4, 1] and value:
+ ///
+ ///
+ /// x = [[[1], [2], [3], [4]],
+ /// [[5], [6], [7], [8]],
+ /// [[9], [10], [11], [12]],
+ /// [[13], [14], [15], [16]]]
+ ///
+ ///
+ /// (4) For the following input of shape [8, 1, 2, 1] and block_size of 2:
+ ///
+ ///
+ /// x = [[[[1], [3]]], [[[9], [11]]], [[[2], [4]]], [[[10], [12]]],
+ /// [[[5], [7]]], [[[13], [15]]], [[[6], [8]]], [[[14], [16]]]]
+ ///
+ ///
+ /// The output tensor has shape [2, 2, 4, 1] and value:
+ ///
+ ///
+ /// x = [[[[1], [3]], [[5], [7]]],
+ /// [[[2], [4]], [[10], [12]]],
+ /// [[[5], [7]], [[13], [15]]],
+ /// [[[6], [8]], [[14], [16]]]]
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// This is a legacy version of the more general BatchToSpaceND.
+ ///
+ /// Rearranges (permutes) data from batch into blocks of spatial data, followed by
+ /// cropping. This is the reverse transformation of SpaceToBatch. More specifically,
+ /// this op outputs a copy of the input tensor where values from the batch
+ /// dimension are moved in spatial blocks to the height and width dimensions,
+ /// followed by cropping along the height and width dimensions.
+ ///
+ public static Tensor batch_to_space (Tensor input, Tensor crops, int block_size, string name = "BatchToSpace")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["crops"] = crops;
+ dict["block_size"] = block_size;
+ var op = _op_def_lib._apply_op_helper("BatchToSpace", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// BatchToSpace for N-D tensors of type T.
+ ///
+ ///
+ /// N-D with shape input_shape = [batch] + spatial_shape + remaining_shape,
+ /// where spatial_shape has M dimensions.
+ ///
+ ///
+ /// 1-D with shape [M], all values must be >= 1.
+ ///
+ ///
+ /// 2-D with shape [M, 2], all values must be >= 0.
+ /// crops[i] = [crop_start, crop_end] specifies the amount to crop from input
+ /// dimension i + 1, which corresponds to spatial dimension i. It is
+ /// required that
+ /// crop_start[i] + crop_end[i] <= block_shape[i] * input_shape[i + 1].
+ ///
+ /// This operation is equivalent to the following steps:
+ ///
+ /// 1. Reshape input to reshaped of shape:
+ /// [block_shape[0], ..., block_shape[M-1],
+ /// batch / prod(block_shape),
+ /// input_shape[1], ..., input_shape[N-1]]
+ ///
+ /// 2. Permute dimensions of reshaped to produce permuted of shape
+ /// [batch / prod(block_shape),
+ ///
+ /// input_shape[1], block_shape[0],
+ /// ...,
+ /// input_shape[M], block_shape[M-1],
+ ///
+ /// input_shape[M+1], ..., input_shape[N-1]]
+ ///
+ /// 3. Reshape permuted to produce reshaped_permuted of shape
+ /// [batch / prod(block_shape),
+ ///
+ /// input_shape[1] * block_shape[0],
+ /// ...,
+ /// input_shape[M] * block_shape[M-1],
+ ///
+ /// input_shape[M+1],
+ /// ...,
+ /// input_shape[N-1]]
+ ///
+ /// 4. Crop the start and end of dimensions [1, ..., M] of
+ /// reshaped_permuted according to crops to produce the output of shape:
+ /// [batch / prod(block_shape),
+ ///
+ /// input_shape[1] * block_shape[0] - crops[0,0] - crops[0,1],
+ /// ...,
+ /// input_shape[M] * block_shape[M-1] - crops[M-1,0] - crops[M-1,1],
+ ///
+ /// input_shape[M+1], ..., input_shape[N-1]]
+ ///
+ /// Some examples:
+ ///
+ /// (1) For the following input of shape [4, 1, 1, 1], block_shape = [2, 2], and
+ /// crops = [[0, 0], [0, 0]]:
+ ///
+ ///
+ /// [[[[1]]], [[[2]]], [[[3]]], [[[4]]]]
+ ///
+ ///
+ /// The output tensor has shape [1, 2, 2, 1] and value:
+ ///
+ ///
+ /// x = [[[[1], [2]], [[3], [4]]]]
+ ///
+ ///
+ /// (2) For the following input of shape [4, 1, 1, 3], block_shape = [2, 2], and
+ /// crops = [[0, 0], [0, 0]]:
+ ///
+ ///
+ /// [[[1, 2, 3]], [[4, 5, 6]], [[7, 8, 9]], [[10, 11, 12]]]
+ ///
+ ///
+ /// The output tensor has shape [1, 2, 2, 3] and value:
+ ///
+ ///
+ /// x = [[[[1, 2, 3], [4, 5, 6]],
+ /// [[7, 8, 9], [10, 11, 12]]]]
+ ///
+ ///
+ /// (3) For the following input of shape [4, 2, 2, 1], block_shape = [2, 2], and
+ /// crops = [[0, 0], [0, 0]]:
+ ///
+ ///
+ /// x = [[[[1], [3]], [[9], [11]]],
+ /// [[[2], [4]], [[10], [12]]],
+ /// [[[5], [7]], [[13], [15]]],
+ /// [[[6], [8]], [[14], [16]]]]
+ ///
+ ///
+ /// The output tensor has shape [1, 4, 4, 1] and value:
+ ///
+ ///
+ /// x = [[[1], [2], [3], [4]],
+ /// [[5], [6], [7], [8]],
+ /// [[9], [10], [11], [12]],
+ /// [[13], [14], [15], [16]]]
+ ///
+ ///
+ /// (4) For the following input of shape [8, 1, 3, 1], block_shape = [2, 2], and
+ /// crops = [[0, 0], [2, 0]]:
+ ///
+ ///
+ /// x = [[[[0], [1], [3]]], [[[0], [9], [11]]],
+ /// [[[0], [2], [4]]], [[[0], [10], [12]]],
+ /// [[[0], [5], [7]]], [[[0], [13], [15]]],
+ /// [[[0], [6], [8]]], [[[0], [14], [16]]]]
+ ///
+ ///
+ /// The output tensor has shape [2, 2, 4, 1] and value:
+ ///
+ ///
+ /// x = [[[[1], [2], [3], [4]],
+ /// [[5], [6], [7], [8]]],
+ /// [[[9], [10], [11], [12]],
+ /// [[13], [14], [15], [16]]]]
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BatchToSpaceND'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// This operation reshapes the "batch" dimension 0 into M + 1 dimensions of shape
+ /// block_shape + [batch], interleaves these blocks back into the grid defined by
+ /// the spatial dimensions [1, ..., M], to obtain a result with the same rank as
+ /// the input. The spatial dimensions of this intermediate result are then
+ /// optionally cropped according to crops to produce the output. This is the
+ /// reverse of SpaceToBatch. See below for a precise description.
+ ///
+ public static Tensor batch_to_space_n_d (Tensor input, Tensor block_shape, Tensor crops, string name = "BatchToSpaceND")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["block_shape"] = block_shape;
+ dict["crops"] = crops;
+ var op = _op_def_lib._apply_op_helper("BatchToSpaceND", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes the Bessel i0e function of x element-wise.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BesselI0e'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Exponentially scaled modified Bessel function of order 0 defined as
+ /// bessel_i0e(x) = exp(-abs(x)) bessel_i0(x).
+ ///
+ /// This function is faster and numerically stabler than bessel_i0(x).
+ ///
+ public static Tensor bessel_i0e (Tensor x, string name = "BesselI0e")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ var op = _op_def_lib._apply_op_helper("BesselI0e", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes the Bessel i1e function of x element-wise.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BesselI1e'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Exponentially scaled modified Bessel function of order 0 defined as
+ /// bessel_i1e(x) = exp(-abs(x)) bessel_i1(x).
+ ///
+ /// This function is faster and numerically stabler than bessel_i1(x).
+ ///
+ public static Tensor bessel_i1e (Tensor x, string name = "BesselI1e")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ var op = _op_def_lib._apply_op_helper("BesselI1e", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Compute the regularized incomplete beta integral \\(I_x(a, b)\\).
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Betainc'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// The regularized incomplete beta integral is defined as:
+ ///
+ ///
+ /// \\(I_x(a, b) = \frac{B(x; a, b)}{B(a, b)}\\)
+ ///
+ /// where
+ ///
+ ///
+ /// \\(B(x; a, b) = \int_0^x t^{a-1} (1 - t)^{b-1} dt\\)
+ ///
+ ///
+ /// is the incomplete beta function and \\(B(a, b)\\) is the *complete*
+ /// beta function.
+ ///
+ public static Tensor betainc (Tensor a, Tensor b, Tensor x, string name = "Betainc")
+ {
+ var dict = new Dictionary();
+ dict["a"] = a;
+ dict["b"] = b;
+ dict["x"] = x;
+ var op = _op_def_lib._apply_op_helper("Betainc", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Adds bias to value.
+ ///
+ ///
+ /// Any number of dimensions.
+ ///
+ ///
+ /// 1-D with size the last dimension of value.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BiasAdd'.
+ ///
+ ///
+ /// Specify the data format of the input and output data. With the
+ /// default format "NHWC", the bias tensor will be added to the last dimension
+ /// of the value tensor.
+ /// Alternatively, the format could be "NCHW", the data storage order of:
+ /// [batch, in_channels, in_height, in_width].
+ /// The tensor will be added to "in_channels", the third-to-the-last
+ /// dimension.
+ ///
+ ///
+ /// Broadcasted sum of value and bias.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// This is a special case of tf.add where bias is restricted to be 1-D.
+ /// Broadcasting is supported, so value may have any number of dimensions.
+ ///
+ public static Tensor bias_add (Tensor value, Tensor bias, string data_format = null, string name = "BiasAdd")
+ {
+ var dict = new Dictionary();
+ dict["value"] = value;
+ dict["bias"] = bias;
+ if (data_format != null)
+ dict["data_format"] = data_format;
+ var op = _op_def_lib._apply_op_helper("BiasAdd", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// The backward operation for "BiasAdd" on the "bias" tensor.
+ ///
+ ///
+ /// Any number of dimensions.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BiasAddGrad'.
+ ///
+ ///
+ /// Specify the data format of the input and output data. With the
+ /// default format "NHWC", the bias tensor will be added to the last dimension
+ /// of the value tensor.
+ /// Alternatively, the format could be "NCHW", the data storage order of:
+ /// [batch, in_channels, in_height, in_width].
+ /// The tensor will be added to "in_channels", the third-to-the-last
+ /// dimension.
+ ///
+ ///
+ /// 1-D with size the feature dimension of out_backprop.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// It accumulates all the values from out_backprop into the feature dimension.
+ /// For NHWC data format, the feature dimension is the last. For NCHW data format,
+ /// the feature dimension is the third-to-last.
+ ///
+ public static Tensor bias_add_grad (Tensor out_backprop, string data_format = null, string name = "BiasAddGrad")
+ {
+ var dict = new Dictionary();
+ dict["out_backprop"] = out_backprop;
+ if (data_format != null)
+ dict["data_format"] = data_format;
+ var op = _op_def_lib._apply_op_helper("BiasAddGrad", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Adds bias to value.
+ ///
+ ///
+ /// Any number of dimensions.
+ ///
+ ///
+ /// 1-D with size the last dimension of value.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BiasAddV1'.
+ ///
+ ///
+ /// Broadcasted sum of value and bias.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// This is a deprecated version of BiasAdd and will be soon removed.
+ ///
+ /// This is a special case of tf.add where bias is restricted to be 1-D.
+ /// Broadcasting is supported, so value may have any number of dimensions.
+ ///
+ public static Tensor bias_add_v1 (Tensor value, Tensor bias, string name = "BiasAddV1")
+ {
+ var dict = new Dictionary();
+ dict["value"] = value;
+ dict["bias"] = bias;
+ var op = _op_def_lib._apply_op_helper("BiasAddV1", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Counts the number of occurrences of each value in an integer array.
+ ///
+ ///
+ /// int32 Tensor.
+ ///
+ ///
+ /// non-negative int32 scalar Tensor.
+ ///
+ ///
+ /// is an int32, int64, float32, or float64 Tensor with the same
+ /// shape as arr, or a length-0 Tensor, in which case it acts as all weights
+ /// equal to 1.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Bincount'.
+ ///
+ ///
+ /// 1D Tensor with length equal to size. The counts or summed weights for
+ /// each value in the range [0, size).
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Outputs a vector with length size and the same dtype as weights. If
+ /// weights are empty, then index i stores the number of times the value i is
+ /// counted in arr. If weights are non-empty, then index i stores the sum of
+ /// the value in weights at each index where the corresponding value in arr is
+ /// i.
+ ///
+ /// Values in arr outside of the range [0, size) are ignored.
+ ///
+ public static Tensor bincount (Tensor arr, Tensor size, Tensor weights, string name = "Bincount")
+ {
+ var dict = new Dictionary();
+ dict["arr"] = arr;
+ dict["size"] = size;
+ dict["weights"] = weights;
+ var op = _op_def_lib._apply_op_helper("Bincount", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Bitcasts a tensor from one type to another without copying data.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Bitcast'.
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Given a tensor input, this operation returns a tensor that has the same buffer
+ /// data as input with datatype type.
+ ///
+ /// If the input datatype T is larger than the output datatype type then the
+ /// shape changes from [...] to [..., sizeof(T)/sizeof(type)].
+ ///
+ /// If T is smaller than type, the operator requires that the rightmost
+ /// dimension be equal to sizeof(type)/sizeof(T). The shape then goes from
+ /// [..., sizeof(type)/sizeof(T)] to [...].
+ ///
+ /// *NOTE*: Bitcast is implemented as a low-level cast, so machines with different
+ /// endian orderings will give different results.
+ ///
+ public static Tensor bitcast (Tensor input, TF_DataType type, string name = "Bitcast")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["type"] = type;
+ var op = _op_def_lib._apply_op_helper("Bitcast", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Elementwise computes the bitwise AND of x and y.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BitwiseAnd'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// The result will have those bits set, that are set in both x and y. The
+ /// computation is performed on the underlying representations of x and y.
+ ///
+ public static Tensor bitwise_and (Tensor x, Tensor y, string name = "BitwiseAnd")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ dict["y"] = y;
+ var op = _op_def_lib._apply_op_helper("BitwiseAnd", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Elementwise computes the bitwise OR of x and y.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BitwiseOr'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// The result will have those bits set, that are set in x, y or both. The
+ /// computation is performed on the underlying representations of x and y.
+ ///
+ public static Tensor bitwise_or (Tensor x, Tensor y, string name = "BitwiseOr")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ dict["y"] = y;
+ var op = _op_def_lib._apply_op_helper("BitwiseOr", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Elementwise computes the bitwise XOR of x and y.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BitwiseXor'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// The result will have those bits set, that are different in x and y. The
+ /// computation is performed on the underlying representations of x and y.
+ ///
+ public static Tensor bitwise_xor (Tensor x, Tensor y, string name = "BitwiseXor")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ dict["y"] = y;
+ var op = _op_def_lib._apply_op_helper("BitwiseXor", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Calculates gains for each feature and returns the best possible split information for the feature.
+ ///
+ ///
+ /// A Rank 1 tensor (shape=[2]) to specify the range [first, last) of node ids to process within stats_summary_list. The nodes are iterated between the two nodes specified by the tensor, as like for node_id in range(node_id_range[0], node_id_range[1]) (Note that the last index node_id_range[1] is exclusive).
+ ///
+ ///
+ /// A list of Rank 3 tensor (#shape=[max_splits, bucket, 2]) for accumulated stats summary (gradient/hessian) per node per buckets for each feature. The first dimension of the tensor is the maximum number of splits, and thus not all elements of it will be used, but only the indexes specified by node_ids will be used.
+ ///
+ ///
+ /// l1 regularization factor on leaf weights, per instance based.
+ ///
+ ///
+ /// l2 regularization factor on leaf weights, per instance based.
+ ///
+ ///
+ /// adjustment to the gain, per leaf based.
+ ///
+ ///
+ /// mininum avg of hessians in a node before required for the node to be considered for splitting.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BoostedTreesCalculateBestGainsPerFeature'.
+ ///
+ ///
+ /// Optional argument
+ /// the number of nodes that can be split in the whole tree. Used as a dimension of output tensors.
+ ///
+ ///
+ /// Returns a tuple with multiple values, as follows:
+ /// node_ids_list : An output list of Rank 1 tensors indicating possible split node ids for each feature. The length of the list is num_features, but each tensor has different size as each feature provides different possible nodes. See above for details like shapes and sizes.
+ /// gains_list : An output list of Rank 1 tensors indicating the best gains for each feature to split for certain nodes. See above for details like shapes and sizes.
+ /// thresholds_list : An output list of Rank 1 tensors indicating the bucket id to compare with (as a threshold) for split in each node. See above for details like shapes and sizes.
+ /// left_node_contribs_list : A list of Rank 2 tensors indicating the contribution of the left nodes when branching from parent nodes (given by the tensor element in the output node_ids_list) to the left direction by the given threshold for each feature. This value will be used to make the left node value by adding to the parent node value. Second dimension size is 1 for 1-dimensional logits, but would be larger for multi-class problems. See above for details like shapes and sizes.
+ /// right_node_contribs_list : A list of Rank 2 tensors, with the same shape/conditions as left_node_contribs_list, but just that the value is for the right node.
+ /// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
+ ///
+ ///
+ /// The split information is the best threshold (bucket id), gains and left/right node contributions per node for each feature.
+ ///
+ /// It is possible that not all nodes can be split on each feature. Hence, the list of possible nodes can differ between the features. Therefore, we return node_ids_list for each feature, containing the list of nodes that this feature can be used to split.
+ ///
+ /// In this manner, the output is the best split per features and per node, so that it needs to be combined later to produce the best split for each node (among all possible features).
+ ///
+ /// The length of output lists are all of the same length, num_features.
+ /// The output shapes are compatible in a way that the first dimension of all tensors of all lists are the same and equal to the number of possible split nodes for each feature.
+ ///
+ public static (Tensor[] node_ids_list, Tensor[] gains_list, Tensor[] thresholds_list, Tensor[] left_node_contribs_list, Tensor[] right_node_contribs_list) boosted_trees_calculate_best_gains_per_feature (Tensor node_id_range, Tensor[] stats_summary_list, Tensor l1, Tensor l2, Tensor tree_complexity, Tensor min_node_weight, int max_splits, string name = "BoostedTreesCalculateBestGainsPerFeature")
+ {
+ var dict = new Dictionary();
+ dict["node_id_range"] = node_id_range;
+ dict["stats_summary_list"] = stats_summary_list;
+ dict["l1"] = l1;
+ dict["l2"] = l2;
+ dict["tree_complexity"] = tree_complexity;
+ dict["min_node_weight"] = min_node_weight;
+ dict["max_splits"] = max_splits;
+ var op = _op_def_lib._apply_op_helper("BoostedTreesCalculateBestGainsPerFeature", name: name, keywords: dict);
+ int _idx = 0;
+ var node_ids_list = Enumerable.Range(0, op.OutputListLength("node_ids_list")).Select(_ => op.outputs[_idx++]).ToArray();
+ var gains_list = Enumerable.Range(0, op.OutputListLength("gains_list")).Select(_ => op.outputs[_idx++]).ToArray();
+ var thresholds_list = Enumerable.Range(0, op.OutputListLength("thresholds_list")).Select(_ => op.outputs[_idx++]).ToArray();
+ var left_node_contribs_list = Enumerable.Range(0, op.OutputListLength("left_node_contribs_list")).Select(_ => op.outputs[_idx++]).ToArray();
+ var right_node_contribs_list = Enumerable.Range(0, op.OutputListLength("right_node_contribs_list")).Select(_ => op.outputs[_idx++]).ToArray();
+ return (node_ids_list, gains_list, thresholds_list, left_node_contribs_list, right_node_contribs_list);
+ }
+
+ ///
+ /// Calculates the prior from the training data (the bias) and fills in the first node with the logits' prior. Returns a boolean indicating whether to continue centering.
+ ///
+ ///
+ /// Handle to the tree ensemble.
+ ///
+ ///
+ /// A tensor with shape=[logits_dimension] with mean of gradients for a first node.
+ ///
+ ///
+ /// A tensor with shape=[logits_dimension] mean of hessians for a first node.
+ ///
+ ///
+ /// l1 regularization factor on leaf weights, per instance based.
+ ///
+ ///
+ /// l2 regularization factor on leaf weights, per instance based.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BoostedTreesCenterBias'.
+ ///
+ ///
+ /// Bool, whether to continue bias centering.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor boosted_trees_center_bias (Tensor tree_ensemble_handle, Tensor mean_gradients, Tensor mean_hessians, Tensor l1, Tensor l2, string name = "BoostedTreesCenterBias")
+ {
+ var dict = new Dictionary();
+ dict["tree_ensemble_handle"] = tree_ensemble_handle;
+ dict["mean_gradients"] = mean_gradients;
+ dict["mean_hessians"] = mean_hessians;
+ dict["l1"] = l1;
+ dict["l2"] = l2;
+ var op = _op_def_lib._apply_op_helper("BoostedTreesCenterBias", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Creates a tree ensemble model and returns a handle to it.
+ ///
+ ///
+ /// Handle to the tree ensemble resource to be created.
+ ///
+ ///
+ /// Token to use as the initial value of the resource stamp.
+ ///
+ ///
+ /// Serialized proto of the tree ensemble.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BoostedTreesCreateEnsemble'.
+ ///
+ ///
+ /// Returns the description of the operation
+ ///
+ public static Operation boosted_trees_create_ensemble (Tensor tree_ensemble_handle, Tensor stamp_token, Tensor tree_ensemble_serialized, string name = "BoostedTreesCreateEnsemble")
+ {
+ var dict = new Dictionary();
+ dict["tree_ensemble_handle"] = tree_ensemble_handle;
+ dict["stamp_token"] = stamp_token;
+ dict["tree_ensemble_serialized"] = tree_ensemble_serialized;
+ var op = _op_def_lib._apply_op_helper("BoostedTreesCreateEnsemble", name: name, keywords: dict);
+ return op;
+ }
+
+ ///
+ /// Deserializes a serialized tree ensemble config and replaces current tree
+ ///
+ ///
+ /// Handle to the tree ensemble.
+ ///
+ ///
+ /// Token to use as the new value of the resource stamp.
+ ///
+ ///
+ /// Serialized proto of the ensemble.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BoostedTreesDeserializeEnsemble'.
+ ///
+ ///
+ /// Returns the description of the operation
+ ///
+ ///
+ /// ensemble.
+ ///
+ public static Operation boosted_trees_deserialize_ensemble (Tensor tree_ensemble_handle, Tensor stamp_token, Tensor tree_ensemble_serialized, string name = "BoostedTreesDeserializeEnsemble")
+ {
+ var dict = new Dictionary();
+ dict["tree_ensemble_handle"] = tree_ensemble_handle;
+ dict["stamp_token"] = stamp_token;
+ dict["tree_ensemble_serialized"] = tree_ensemble_serialized;
+ var op = _op_def_lib._apply_op_helper("BoostedTreesDeserializeEnsemble", name: name, keywords: dict);
+ return op;
+ }
+
+ ///
+ /// Creates a handle to a BoostedTreesEnsembleResource
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BoostedTreesEnsembleResourceHandleOp'.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor boosted_trees_ensemble_resource_handle_op (string container = null, string shared_name = null, string name = "BoostedTreesEnsembleResourceHandleOp")
+ {
+ var dict = new Dictionary();
+ if (container != null)
+ dict["container"] = container;
+ if (shared_name != null)
+ dict["shared_name"] = shared_name;
+ var op = _op_def_lib._apply_op_helper("BoostedTreesEnsembleResourceHandleOp", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Debugging/model interpretability outputs for each example.
+ ///
+ ///
+ ///
+ ///
+ /// A list of rank 1 Tensors containing bucket id for each
+ /// feature.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BoostedTreesExampleDebugOutputs'.
+ ///
+ ///
+ /// Optional argument
+ /// scalar, dimension of the logits, to be used for constructing the protos in
+ /// examples_debug_outputs_serialized.
+ ///
+ ///
+ /// Output rank 1 Tensor containing a proto serialized as a string for each example.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// It traverses all the trees and computes debug metrics for individual examples,
+ /// such as getting split feature ids and logits after each split along the decision
+ /// path used to compute directional feature contributions.
+ ///
+ public static Tensor boosted_trees_example_debug_outputs (Tensor tree_ensemble_handle, Tensor[] bucketized_features, int logits_dimension, string name = "BoostedTreesExampleDebugOutputs")
+ {
+ var dict = new Dictionary();
+ dict["tree_ensemble_handle"] = tree_ensemble_handle;
+ dict["bucketized_features"] = bucketized_features;
+ dict["logits_dimension"] = logits_dimension;
+ var op = _op_def_lib._apply_op_helper("BoostedTreesExampleDebugOutputs", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Retrieves the tree ensemble resource stamp token, number of trees and growing statistics.
+ ///
+ ///
+ /// Handle to the tree ensemble.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BoostedTreesGetEnsembleStates'.
+ ///
+ ///
+ /// Returns a tuple with multiple values, as follows:
+ /// stamp_token : Stamp token of the tree ensemble resource.
+ /// num_trees : The number of trees in the tree ensemble resource.
+ /// num_finalized_trees : The number of trees that were finished successfully.
+ /// num_attempted_layers : The number of layers we attempted to build (but not necessarily succeeded).
+ /// last_layer_nodes_range : Rank size 2 tensor that contains start and end ids of the nodes in the latest
+ /// layer.
+ /// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
+ ///
+ public static (Tensor stamp_token, Tensor num_trees, Tensor num_finalized_trees, Tensor num_attempted_layers, Tensor last_layer_nodes_range) boosted_trees_get_ensemble_states (Tensor tree_ensemble_handle, string name = "BoostedTreesGetEnsembleStates")
+ {
+ var dict = new Dictionary();
+ dict["tree_ensemble_handle"] = tree_ensemble_handle;
+ var op = _op_def_lib._apply_op_helper("BoostedTreesGetEnsembleStates", name: name, keywords: dict);
+ int _idx = 0;
+ var stamp_token = op.outputs[_idx++];
+ var num_trees = op.outputs[_idx++];
+ var num_finalized_trees = op.outputs[_idx++];
+ var num_attempted_layers = op.outputs[_idx++];
+ var last_layer_nodes_range = op.outputs[_idx++];
+ return (stamp_token, num_trees, num_finalized_trees, num_attempted_layers, last_layer_nodes_range);
+ }
+
+ ///
+ /// Makes the summary of accumulated stats for the batch.
+ ///
+ ///
+ /// int32 Rank 1 Tensor containing node ids, which each example falls into for the requested layer.
+ ///
+ ///
+ /// float32; Rank 2 Tensor (shape=[#examples, 1]) for gradients.
+ ///
+ ///
+ /// float32; Rank 2 Tensor (shape=[#examples, 1]) for hessians.
+ ///
+ ///
+ /// int32 list of Rank 1 Tensors, each containing the bucketized feature (for each feature column).
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BoostedTreesMakeStatsSummary'.
+ ///
+ ///
+ /// Optional argument
+ /// int; the maximum number of splits possible in the whole tree.
+ ///
+ ///
+ /// Optional argument
+ /// int; equals to the maximum possible value of bucketized feature.
+ ///
+ ///
+ /// output Rank 4 Tensor (shape=[#features, #splits, #buckets, 2]) containing accumulated stats put into the corresponding node and bucket. The first index of 4th dimension refers to gradients, and the second to hessians.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// The summary stats contains gradients and hessians accumulated into the corresponding node and bucket for each example.
+ ///
+ public static Tensor boosted_trees_make_stats_summary (Tensor node_ids, Tensor gradients, Tensor hessians, Tensor[] bucketized_features_list, int max_splits, int num_buckets, string name = "BoostedTreesMakeStatsSummary")
+ {
+ var dict = new Dictionary();
+ dict["node_ids"] = node_ids;
+ dict["gradients"] = gradients;
+ dict["hessians"] = hessians;
+ dict["bucketized_features_list"] = bucketized_features_list;
+ dict["max_splits"] = max_splits;
+ dict["num_buckets"] = num_buckets;
+ var op = _op_def_lib._apply_op_helper("BoostedTreesMakeStatsSummary", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Runs multiple additive regression ensemble predictors on input instances and
+ ///
+ ///
+ ///
+ ///
+ /// A list of rank 1 Tensors containing bucket id for each
+ /// feature.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BoostedTreesPredict'.
+ ///
+ ///
+ /// Optional argument
+ /// scalar, dimension of the logits, to be used for partial logits
+ /// shape.
+ ///
+ ///
+ /// Output rank 2 Tensor containing logits for each example.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// computes the logits. It is designed to be used during prediction.
+ /// It traverses all the trees and calculates the final score for each instance.
+ ///
+ public static Tensor boosted_trees_predict (Tensor tree_ensemble_handle, Tensor[] bucketized_features, int logits_dimension, string name = "BoostedTreesPredict")
+ {
+ var dict = new Dictionary();
+ dict["tree_ensemble_handle"] = tree_ensemble_handle;
+ dict["bucketized_features"] = bucketized_features;
+ dict["logits_dimension"] = logits_dimension;
+ var op = _op_def_lib._apply_op_helper("BoostedTreesPredict", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Serializes the tree ensemble to a proto.
+ ///
+ ///
+ /// Handle to the tree ensemble.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BoostedTreesSerializeEnsemble'.
+ ///
+ ///
+ /// Returns a tuple with multiple values, as follows:
+ /// stamp_token : Stamp token of the tree ensemble resource.
+ /// tree_ensemble_serialized : Serialized proto of the ensemble.
+ /// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
+ ///
+ public static (Tensor stamp_token, Tensor tree_ensemble_serialized) boosted_trees_serialize_ensemble (Tensor tree_ensemble_handle, string name = "BoostedTreesSerializeEnsemble")
+ {
+ var dict = new Dictionary();
+ dict["tree_ensemble_handle"] = tree_ensemble_handle;
+ var op = _op_def_lib._apply_op_helper("BoostedTreesSerializeEnsemble", name: name, keywords: dict);
+ int _idx = 0;
+ var stamp_token = op.outputs[_idx++];
+ var tree_ensemble_serialized = op.outputs[_idx++];
+ return (stamp_token, tree_ensemble_serialized);
+ }
+
+ ///
+ /// Runs multiple additive regression ensemble predictors on input instances and
+ ///
+ ///
+ ///
+ ///
+ /// Rank 1 Tensor containing cached tree ids which is the starting
+ /// tree of prediction.
+ ///
+ ///
+ /// Rank 1 Tensor containing cached node id which is the starting
+ /// node of prediction.
+ ///
+ ///
+ /// A list of rank 1 Tensors containing bucket id for each
+ /// feature.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BoostedTreesTrainingPredict'.
+ ///
+ ///
+ /// Optional argument
+ /// scalar, dimension of the logits, to be used for partial logits
+ /// shape.
+ ///
+ ///
+ /// Returns a tuple with multiple values, as follows:
+ /// partial_logits : Rank 2 Tensor containing logits update (with respect to cached
+ /// values stored) for each example.
+ /// tree_ids : Rank 1 Tensor containing new tree ids for each example.
+ /// node_ids : Rank 1 Tensor containing new node ids in the new tree_ids.
+ /// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
+ ///
+ ///
+ /// computes the update to cached logits. It is designed to be used during training.
+ /// It traverses the trees starting from cached tree id and cached node id and
+ /// calculates the updates to be pushed to the cache.
+ ///
+ public static (Tensor partial_logits, Tensor tree_ids, Tensor node_ids) boosted_trees_training_predict (Tensor tree_ensemble_handle, Tensor cached_tree_ids, Tensor cached_node_ids, Tensor[] bucketized_features, int logits_dimension, string name = "BoostedTreesTrainingPredict")
+ {
+ var dict = new Dictionary();
+ dict["tree_ensemble_handle"] = tree_ensemble_handle;
+ dict["cached_tree_ids"] = cached_tree_ids;
+ dict["cached_node_ids"] = cached_node_ids;
+ dict["bucketized_features"] = bucketized_features;
+ dict["logits_dimension"] = logits_dimension;
+ var op = _op_def_lib._apply_op_helper("BoostedTreesTrainingPredict", name: name, keywords: dict);
+ int _idx = 0;
+ var partial_logits = op.outputs[_idx++];
+ var tree_ids = op.outputs[_idx++];
+ var node_ids = op.outputs[_idx++];
+ return (partial_logits, tree_ids, node_ids);
+ }
+
+ ///
+ /// Updates the tree ensemble by either adding a layer to the last tree being grown
+ ///
+ ///
+ /// Handle to the ensemble variable.
+ ///
+ ///
+ /// Rank 1 tensor with ids for each feature. This is the real id of
+ /// the feature that will be used in the split.
+ ///
+ ///
+ /// List of rank 1 tensors representing the nodes for which this feature
+ /// has a split.
+ ///
+ ///
+ /// List of rank 1 tensors representing the gains for each of the feature's
+ /// split.
+ ///
+ ///
+ /// List of rank 1 tensors representing the thesholds for each of the
+ /// feature's split.
+ ///
+ ///
+ /// List of rank 2 tensors with left leaf contribs for each of
+ /// the feature's splits. Will be added to the previous node values to constitute
+ /// the values of the left nodes.
+ ///
+ ///
+ /// List of rank 2 tensors with right leaf contribs for each
+ /// of the feature's splits. Will be added to the previous node values to constitute
+ /// the values of the right nodes.
+ ///
+ ///
+ /// Max depth of the tree to build.
+ ///
+ ///
+ /// shrinkage const for each new tree.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BoostedTreesUpdateEnsemble'.
+ ///
+ ///
+ /// Optional argument
+ /// 0-No pruning, 1-Pre-pruning, 2-Post-pruning.
+ ///
+ ///
+ /// Returns the description of the operation
+ ///
+ ///
+ /// or by starting a new tree.
+ ///
+ public static Operation boosted_trees_update_ensemble (Tensor tree_ensemble_handle, Tensor feature_ids, Tensor[] node_ids, Tensor[] gains, Tensor[] thresholds, Tensor[] left_node_contribs, Tensor[] right_node_contribs, Tensor max_depth, Tensor learning_rate, int pruning_mode, string name = "BoostedTreesUpdateEnsemble")
+ {
+ var dict = new Dictionary();
+ dict["tree_ensemble_handle"] = tree_ensemble_handle;
+ dict["feature_ids"] = feature_ids;
+ dict["node_ids"] = node_ids;
+ dict["gains"] = gains;
+ dict["thresholds"] = thresholds;
+ dict["left_node_contribs"] = left_node_contribs;
+ dict["right_node_contribs"] = right_node_contribs;
+ dict["max_depth"] = max_depth;
+ dict["learning_rate"] = learning_rate;
+ dict["pruning_mode"] = pruning_mode;
+ var op = _op_def_lib._apply_op_helper("BoostedTreesUpdateEnsemble", name: name, keywords: dict);
+ return op;
+ }
+
+ ///
+ /// Return the shape of s0 op s1 with broadcast.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BroadcastArgs'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Given s0 and s1, tensors that represent shapes, compute r0, the
+ /// broadcasted shape. s0, s1 and r0 are all integer vectors.
+ ///
+ public static Tensor broadcast_args (Tensor s0, Tensor s1, string name = "BroadcastArgs")
+ {
+ var dict = new Dictionary();
+ dict["s0"] = s0;
+ dict["s1"] = s1;
+ var op = _op_def_lib._apply_op_helper("BroadcastArgs", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Return the reduction indices for computing gradients of s0 op s1 with broadcast.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BroadcastGradientArgs'.
+ ///
+ ///
+ /// Returns a tuple with multiple values, as follows:
+ /// r0 :
+ /// r1 :
+ /// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
+ ///
+ ///
+ /// This is typically used by gradient computations for a broadcasting operation.
+ ///
+ public static (Tensor r0, Tensor r1) broadcast_gradient_args (Tensor s0, Tensor s1, string name = "BroadcastGradientArgs")
+ {
+ var dict = new Dictionary();
+ dict["s0"] = s0;
+ dict["s1"] = s1;
+ var op = _op_def_lib._apply_op_helper("BroadcastGradientArgs", name: name, keywords: dict);
+ int _idx = 0;
+ var r0 = op.outputs[_idx++];
+ var r1 = op.outputs[_idx++];
+ return (r0, r1);
+ }
+
+ ///
+ /// Broadcast an array for a compatible shape.
+ ///
+ ///
+ /// A Tensor to broadcast.
+ ///
+ ///
+ /// An 1-D int Tensor. The shape of the desired output.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BroadcastTo'.
+ ///
+ ///
+ /// A Tensor.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Broadcasting is the process of making arrays to have compatible shapes
+ /// for arithmetic operations. Two shapes are compatible if for each
+ /// dimension pair they are either equal or one of them is one. When trying
+ /// to broadcast a Tensor to a shape, it starts with the trailing dimensions,
+ /// and works its way forward.
+ ///
+ /// For example,
+ ///
+ /// >>> x = tf.constant([1, 2, 3])
+ /// >>> y = tf.broadcast_to(x, [3, 3])
+ /// >>> sess.run(y)
+ /// array([[1, 2, 3],
+ /// [1, 2, 3],
+ /// [1, 2, 3]], dtype=int32)
+ ///
+ /// In the above example, the input Tensor with the shape of [1, 3]
+ /// is broadcasted to output Tensor with shape of [3, 3].
+ ///
+ public static Tensor broadcast_to (Tensor input, Tensor shape, string name = "BroadcastTo")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["shape"] = shape;
+ var op = _op_def_lib._apply_op_helper("BroadcastTo", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Bucketizes 'input' based on 'boundaries'.
+ ///
+ ///
+ /// Any shape of Tensor contains with int or float type.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Bucketize'.
+ ///
+ ///
+ /// Optional argument
+ /// A sorted list of floats gives the boundary of the buckets.
+ ///
+ ///
+ /// Same shape with 'input', each value of input replaced with bucket index.
+ ///
+ /// @compatibility(numpy)
+ /// Equivalent to np.digitize.
+ /// @end_compatibility
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// For example, if the inputs are
+ /// boundaries = [0, 10, 100]
+ /// input = [[-5, 10000]
+ /// [150, 10]
+ /// [5, 100]]
+ ///
+ /// then the output will be
+ /// output = [[0, 3]
+ /// [3, 2]
+ /// [1, 3]]
+ ///
+ public static Tensor bucketize (Tensor input, float[] boundaries, string name = "Bucketize")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["boundaries"] = boundaries;
+ var op = _op_def_lib._apply_op_helper("Bucketize", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Records the bytes size of each element of input_dataset in a StatsAggregator.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BytesProducedStatsDataset'.
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor bytes_produced_stats_dataset (Tensor input_dataset, Tensor tag, TF_DataType[] output_types, TensorShape[] output_shapes, string name = "BytesProducedStatsDataset")
+ {
+ var dict = new Dictionary();
+ dict["input_dataset"] = input_dataset;
+ dict["tag"] = tag;
+ dict["output_types"] = output_types;
+ dict["output_shapes"] = output_shapes;
+ var op = _op_def_lib._apply_op_helper("BytesProducedStatsDataset", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Performs beam search decoding on the logits given in input.
+ ///
+ ///
+ /// 3-D, shape: (max_time x batch_size x num_classes), the logits.
+ ///
+ ///
+ /// A vector containing sequence lengths, size (batch).
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CTCBeamSearchDecoder'.
+ ///
+ ///
+ /// Optional argument
+ /// A scalar >= 0 (beam search beam width).
+ ///
+ ///
+ /// Optional argument
+ /// A scalar >= 0, <= beam_width (controls output size).
+ ///
+ ///
+ /// If true, merge repeated classes in output.
+ ///
+ ///
+ /// Returns a tuple with multiple values, as follows:
+ /// decoded_indices : A list (length: top_paths) of indices matrices. Matrix j,
+ /// size (total_decoded_outputs[j] x 2), has indices of a
+ /// SparseTensor<int64, 2>. The rows store: [batch, time].
+ /// decoded_values : A list (length: top_paths) of values vectors. Vector j,
+ /// size (length total_decoded_outputs[j]), has the values of a
+ /// SparseTensor<int64, 2>. The vector stores the decoded classes for beam j.
+ /// decoded_shape : A list (length: top_paths) of shape vector. Vector j,
+ /// size (2), stores the shape of the decoded SparseTensor[j].
+ /// Its values are: [batch_size, max_decoded_length[j]].
+ /// log_probability : A matrix, shaped: (batch_size x top_paths). The
+ /// sequence log-probabilities.
+ /// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
+ ///
+ ///
+ /// A note about the attribute merge_repeated: For the beam search decoder,
+ /// this means that if consecutive entries in a beam are the same, only
+ /// the first of these is emitted. That is, when the top path is "A B B B B",
+ /// "A B" is returned if merge_repeated = True but "A B B B B" is
+ /// returned if merge_repeated = False.
+ ///
+ public static (Tensor[] decoded_indices, Tensor[] decoded_values, Tensor[] decoded_shape, Tensor log_probability) c_t_c_beam_search_decoder (Tensor inputs, Tensor sequence_length, int beam_width, int top_paths, bool? merge_repeated = null, string name = "CTCBeamSearchDecoder")
+ {
+ var dict = new Dictionary();
+ dict["inputs"] = inputs;
+ dict["sequence_length"] = sequence_length;
+ dict["beam_width"] = beam_width;
+ dict["top_paths"] = top_paths;
+ if (merge_repeated.HasValue)
+ dict["merge_repeated"] = merge_repeated.Value;
+ var op = _op_def_lib._apply_op_helper("CTCBeamSearchDecoder", name: name, keywords: dict);
+ int _idx = 0;
+ var decoded_indices = Enumerable.Range(0, op.OutputListLength("decoded_indices")).Select(_ => op.outputs[_idx++]).ToArray();
+ var decoded_values = Enumerable.Range(0, op.OutputListLength("decoded_values")).Select(_ => op.outputs[_idx++]).ToArray();
+ var decoded_shape = Enumerable.Range(0, op.OutputListLength("decoded_shape")).Select(_ => op.outputs[_idx++]).ToArray();
+ var log_probability = op.outputs[_idx++];
+ return (decoded_indices, decoded_values, decoded_shape, log_probability);
+ }
+
+ ///
+ /// Performs greedy decoding on the logits given in inputs.
+ ///
+ ///
+ /// 3-D, shape: (max_time x batch_size x num_classes), the logits.
+ ///
+ ///
+ /// A vector containing sequence lengths, size (batch_size).
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CTCGreedyDecoder'.
+ ///
+ ///
+ /// If True, merge repeated classes in output.
+ ///
+ ///
+ /// Returns a tuple with multiple values, as follows:
+ /// decoded_indices : Indices matrix, size (total_decoded_outputs x 2),
+ /// of a SparseTensor<int64, 2>. The rows store: [batch, time].
+ /// decoded_values : Values vector, size: (total_decoded_outputs),
+ /// of a SparseTensor<int64, 2>. The vector stores the decoded classes.
+ /// decoded_shape : Shape vector, size (2), of the decoded SparseTensor.
+ /// Values are: [batch_size, max_decoded_length].
+ /// log_probability : Matrix, size (batch_size x 1), containing sequence
+ /// log-probabilities.
+ /// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
+ ///
+ ///
+ /// A note about the attribute merge_repeated: if enabled, when
+ /// consecutive logits' maximum indices are the same, only the first of
+ /// these is emitted. Labeling the blank '*', the sequence "A B B * B B"
+ /// becomes "A B B" if merge_repeated = True and "A B B B B" if
+ /// merge_repeated = False.
+ ///
+ /// Regardless of the value of merge_repeated, if the maximum index of a given
+ /// time and batch corresponds to the blank, index (num_classes - 1), no new
+ /// element is emitted.
+ ///
+ public static (Tensor decoded_indices, Tensor decoded_values, Tensor decoded_shape, Tensor log_probability) c_t_c_greedy_decoder (Tensor inputs, Tensor sequence_length, bool? merge_repeated = null, string name = "CTCGreedyDecoder")
+ {
+ var dict = new Dictionary();
+ dict["inputs"] = inputs;
+ dict["sequence_length"] = sequence_length;
+ if (merge_repeated.HasValue)
+ dict["merge_repeated"] = merge_repeated.Value;
+ var op = _op_def_lib._apply_op_helper("CTCGreedyDecoder", name: name, keywords: dict);
+ int _idx = 0;
+ var decoded_indices = op.outputs[_idx++];
+ var decoded_values = op.outputs[_idx++];
+ var decoded_shape = op.outputs[_idx++];
+ var log_probability = op.outputs[_idx++];
+ return (decoded_indices, decoded_values, decoded_shape, log_probability);
+ }
+
+ ///
+ /// Calculates the CTC Loss (log probability) for each batch entry. Also calculates
+ ///
+ ///
+ /// 3-D, shape: (max_time x batch_size x num_classes), the logits.
+ ///
+ ///
+ /// The indices of a SparseTensor<int32, 2>.
+ /// labels_indices(i, :) == [b, t] means labels_values(i) stores the id for
+ /// (batch b, time t).
+ ///
+ ///
+ /// The values (labels) associated with the given batch and time.
+ ///
+ ///
+ /// A vector containing sequence lengths (batch).
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CTCLoss'.
+ ///
+ ///
+ /// Scalar, if true then repeated labels are
+ /// collapsed prior to the CTC calculation.
+ ///
+ ///
+ /// Scalar. If set to false, *during* CTC calculation
+ /// repeated non-blank labels will not be merged and are interpreted as
+ /// individual labels. This is a simplified version of CTC.
+ ///
+ ///
+ /// Scalar. If set to true, during CTC
+ /// calculation, items that have longer output sequences than input sequences
+ /// are skipped: they don't contribute to the loss term and have zero-gradient.
+ ///
+ ///
+ /// Returns a tuple with multiple values, as follows:
+ /// loss : A vector (batch) containing log-probabilities.
+ /// gradient : The gradient of loss. 3-D, shape:
+ /// (max_time x batch_size x num_classes).
+ /// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
+ ///
+ ///
+ /// the gradient. This class performs the softmax operation for you, so inputs
+ /// should be e.g. linear projections of outputs by an LSTM.
+ ///
+ public static (Tensor loss, Tensor gradient) c_t_c_loss (Tensor inputs, Tensor labels_indices, Tensor labels_values, Tensor sequence_length, bool? preprocess_collapse_repeated = null, bool? ctc_merge_repeated = null, bool? ignore_longer_outputs_than_inputs = null, string name = "CTCLoss")
+ {
+ var dict = new Dictionary();
+ dict["inputs"] = inputs;
+ dict["labels_indices"] = labels_indices;
+ dict["labels_values"] = labels_values;
+ dict["sequence_length"] = sequence_length;
+ if (preprocess_collapse_repeated.HasValue)
+ dict["preprocess_collapse_repeated"] = preprocess_collapse_repeated.Value;
+ if (ctc_merge_repeated.HasValue)
+ dict["ctc_merge_repeated"] = ctc_merge_repeated.Value;
+ if (ignore_longer_outputs_than_inputs.HasValue)
+ dict["ignore_longer_outputs_than_inputs"] = ignore_longer_outputs_than_inputs.Value;
+ var op = _op_def_lib._apply_op_helper("CTCLoss", name: name, keywords: dict);
+ int _idx = 0;
+ var loss = op.outputs[_idx++];
+ var gradient = op.outputs[_idx++];
+ return (loss, gradient);
+ }
+
+ ///
+ /// Creates a dataset that caches elements from input_dataset.
+ ///
+ ///
+ ///
+ ///
+ /// A path on the filesystem where we should cache the dataset. Note: this
+ /// will be a directory.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CacheDataset'.
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// A CacheDataset will iterate over the input_dataset, and store tensors. If the
+ /// cache already exists, the cache will be used. If the cache is inappropriate
+ /// (e.g. cannot be opened, contains tensors of the wrong shape / size), an error
+ /// will the returned when used.
+ ///
+ public static Tensor cache_dataset (Tensor input_dataset, Tensor filename, TF_DataType[] output_types, TensorShape[] output_shapes, string name = "CacheDataset")
+ {
+ var dict = new Dictionary();
+ dict["input_dataset"] = input_dataset;
+ dict["filename"] = filename;
+ dict["output_types"] = output_types;
+ dict["output_shapes"] = output_shapes;
+ var op = _op_def_lib._apply_op_helper("CacheDataset", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Cast x of type SrcT to y of DstT.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Cast'.
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor cast (Tensor x, TF_DataType DstT, bool? Truncate = null, string name = "Cast")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ dict["DstT"] = DstT;
+ if (Truncate.HasValue)
+ dict["Truncate"] = Truncate.Value;
+ var op = _op_def_lib._apply_op_helper("Cast", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Returns element-wise smallest integer not less than x.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Ceil'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor ceil (Tensor x, string name = "Ceil")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ var op = _op_def_lib._apply_op_helper("Ceil", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Checks a tensor for NaN and Inf values.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CheckNumerics'.
+ ///
+ ///
+ /// Optional argument
+ /// Prefix of the error message.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// When run, reports an InvalidArgument error if tensor has any values
+ /// that are not a number (NaN) or infinity (Inf). Otherwise, passes tensor as-is.
+ ///
+ public static Tensor check_numerics (Tensor tensor, string message, string name = "CheckNumerics")
+ {
+ var dict = new Dictionary();
+ dict["tensor"] = tensor;
+ dict["message"] = message;
+ var op = _op_def_lib._apply_op_helper("CheckNumerics", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes the Cholesky decomposition of one or more square matrices.
+ ///
+ ///
+ /// Shape is [..., M, M].
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Cholesky'.
+ ///
+ ///
+ /// Shape is [..., M, M].
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// The input is a tensor of shape [..., M, M] whose inner-most 2 dimensions
+ /// form square matrices.
+ ///
+ /// The input has to be symmetric and positive definite. Only the lower-triangular
+ /// part of the input will be used for this operation. The upper-triangular part
+ /// will not be read.
+ ///
+ /// The output is a tensor of the same shape as the input
+ /// containing the Cholesky decompositions for all input submatrices [..., :, :].
+ ///
+ /// **Note**: The gradient computation on GPU is faster for large matrices but
+ /// not for large batch dimensions when the submatrices are small. In this
+ /// case it might be faster to use the CPU.
+ ///
+ public static Tensor cholesky (Tensor input, string name = "Cholesky")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ var op = _op_def_lib._apply_op_helper("Cholesky", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes the reverse mode backpropagated gradient of the Cholesky algorithm.
+ ///
+ ///
+ /// Output of batch Cholesky algorithm l = cholesky(A). Shape is [..., M, M].
+ /// Algorithm depends only on lower triangular part of the innermost matrices of
+ /// this tensor.
+ ///
+ ///
+ /// df/dl where f is some scalar function. Shape is [..., M, M].
+ /// Algorithm depends only on lower triangular part of the innermost matrices of
+ /// this tensor.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CholeskyGrad'.
+ ///
+ ///
+ /// Symmetrized version of df/dA . Shape is [..., M, M]
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// For an explanation see "Differentiation of the Cholesky algorithm" by
+ /// Iain Murray http://arxiv.org/abs/1602.07527.
+ ///
+ public static Tensor cholesky_grad (Tensor l, Tensor grad, string name = "CholeskyGrad")
+ {
+ var dict = new Dictionary();
+ dict["l"] = l;
+ dict["grad"] = grad;
+ var op = _op_def_lib._apply_op_helper("CholeskyGrad", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Clips tensor values to a specified min and max.
+ ///
+ ///
+ /// A Tensor.
+ ///
+ ///
+ /// A 0-D (scalar) Tensor, or a Tensor with the same shape
+ /// as t. The minimum value to clip by.
+ ///
+ ///
+ /// A 0-D (scalar) Tensor, or a Tensor with the same shape
+ /// as t. The maximum value to clip by.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ClipByValue'.
+ ///
+ ///
+ /// A clipped Tensor with the same shape as input 't'.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Given a tensor t, this operation returns a tensor of the same type and
+ /// shape as t with its values clipped to clip_value_min and clip_value_max.
+ /// Any values less than clip_value_min are set to clip_value_min. Any values
+ /// greater than clip_value_max are set to clip_value_max.
+ ///
+ public static Tensor clip_by_value (Tensor t, Tensor clip_value_min, Tensor clip_value_max, string name = "ClipByValue")
+ {
+ var dict = new Dictionary();
+ dict["t"] = t;
+ dict["clip_value_min"] = clip_value_min;
+ dict["clip_value_max"] = clip_value_max;
+ var op = _op_def_lib._apply_op_helper("ClipByValue", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Receives a tensor value broadcast from another device.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CollectiveBcastRecv'.
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor collective_bcast_recv (TF_DataType T, int group_size, int group_key, int instance_key, TensorShape shape, string name = "CollectiveBcastRecv")
+ {
+ var dict = new Dictionary();
+ dict["T"] = T;
+ dict["group_size"] = group_size;
+ dict["group_key"] = group_key;
+ dict["instance_key"] = instance_key;
+ dict["shape"] = shape;
+ var op = _op_def_lib._apply_op_helper("CollectiveBcastRecv", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Broadcasts a tensor value to one or more other devices.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CollectiveBcastSend'.
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor collective_bcast_send (Tensor input, int group_size, int group_key, int instance_key, TensorShape shape, string name = "CollectiveBcastSend")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["group_size"] = group_size;
+ dict["group_key"] = group_key;
+ dict["instance_key"] = instance_key;
+ dict["shape"] = shape;
+ var op = _op_def_lib._apply_op_helper("CollectiveBcastSend", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Mutually reduces multiple tensors of identical type and shape.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CollectiveReduce'.
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor collective_reduce (Tensor input, int group_size, int group_key, int instance_key, string merge_op, string final_op, int[] subdiv_offsets, string name = "CollectiveReduce")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["group_size"] = group_size;
+ dict["group_key"] = group_key;
+ dict["instance_key"] = instance_key;
+ dict["merge_op"] = merge_op;
+ dict["final_op"] = final_op;
+ dict["subdiv_offsets"] = subdiv_offsets;
+ var op = _op_def_lib._apply_op_helper("CollectiveReduce", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Compare values of input to threshold and pack resulting bits into a uint8.
+ ///
+ ///
+ /// Values to compare against threshold and bitpack.
+ ///
+ ///
+ /// Threshold to compare against.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CompareAndBitpack'.
+ ///
+ ///
+ /// The bitpacked comparisons.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Each comparison returns a boolean true (if input_value > threshold)
+ /// or and false otherwise.
+ ///
+ /// This operation is useful for Locality-Sensitive-Hashing (LSH) and other
+ /// algorithms that use hashing approximations of cosine and L2 distances;
+ /// codes can be generated from an input via:
+ ///
+ ///
+ /// codebook_size = 50
+ /// codebook_bits = codebook_size * 32
+ /// codebook = tf.get_variable('codebook', [x.shape[-1].value, codebook_bits],
+ /// dtype=x.dtype,
+ /// initializer=tf.orthogonal_initializer())
+ /// codes = compare_and_threshold(tf.matmul(x, codebook), threshold=0.)
+ /// codes = tf.bitcast(codes, tf.int32) # go from uint8 to int32
+ /// # now codes has shape x.shape[:-1] + [codebook_size]
+ ///
+ ///
+ /// **NOTE**: Currently, the innermost dimension of the tensor must be divisible
+ /// by 8.
+ ///
+ /// Given an input shaped [s0, s1, ..., s_n], the output is
+ /// a uint8 tensor shaped [s0, s1, ..., s_n / 8].
+ ///
+ public static Tensor compare_and_bitpack (Tensor input, Tensor threshold, string name = "CompareAndBitpack")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["threshold"] = threshold;
+ var op = _op_def_lib._apply_op_helper("CompareAndBitpack", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Converts two real numbers to a complex number.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Complex'.
+ ///
+ ///
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Given a tensor real representing the real part of a complex number, and a
+ /// tensor imag representing the imaginary part of a complex number, this
+ /// operation returns complex numbers elementwise of the form \\(a + bj\\), where
+ /// *a* represents the real part and *b* represents the imag part.
+ ///
+ /// The input tensors real and imag must have the same shape.
+ ///
+ /// For example:
+ ///
+ ///
+ /// # tensor 'real' is [2.25, 3.25]
+ /// # tensor imag is [4.75, 5.75]
+ /// tf.complex(real, imag) ==> [[2.25 + 4.75j], [3.25 + 5.75j]]
+ ///
+ ///
+ public static Tensor complex (Tensor real, Tensor imag, TF_DataType? Tout = null, string name = "Complex")
+ {
+ var dict = new Dictionary();
+ dict["real"] = real;
+ dict["imag"] = imag;
+ if (Tout.HasValue)
+ dict["Tout"] = Tout.Value;
+ var op = _op_def_lib._apply_op_helper("Complex", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes the complex absolute value of a tensor.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ComplexAbs'.
+ ///
+ ///
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Given a tensor x of complex numbers, this operation returns a tensor of type
+ /// float or double that is the absolute value of each element in x. All
+ /// elements in x must be complex numbers of the form \\(a + bj\\). The absolute
+ /// value is computed as \\( \sqrt{a^2 + b^2}\\).
+ ///
+ public static Tensor complex_abs (Tensor x, TF_DataType? Tout = null, string name = "ComplexAbs")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ if (Tout.HasValue)
+ dict["Tout"] = Tout.Value;
+ var op = _op_def_lib._apply_op_helper("ComplexAbs", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes the ids of the positions in sampled_candidates that match true_labels.
+ ///
+ ///
+ /// The true_classes output of UnpackSparseLabels.
+ ///
+ ///
+ /// The sampled_candidates output of CandidateSampler.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ComputeAccidentalHits'.
+ ///
+ ///
+ /// Optional argument
+ /// Number of true labels per context.
+ ///
+ ///
+ /// If either seed or seed2 are set to be non-zero, the random number
+ /// generator is seeded by the given seed. Otherwise, it is seeded by a
+ /// random seed.
+ ///
+ ///
+ /// An second seed to avoid seed collision.
+ ///
+ ///
+ /// Returns a tuple with multiple values, as follows:
+ /// indices : A vector of indices corresponding to rows of true_candidates.
+ /// ids : A vector of IDs of positions in sampled_candidates that match a true_label
+ /// for the row with the corresponding index in indices.
+ /// weights : A vector of the same length as indices and ids, in which each element
+ /// is -FLOAT_MAX.
+ /// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
+ ///
+ ///
+ /// When doing log-odds NCE, the result of this op should be passed through a
+ /// SparseToDense op, then added to the logits of the sampled candidates. This has
+ /// the effect of 'removing' the sampled labels that match the true labels by
+ /// making the classifier sure that they are sampled labels.
+ ///
+ public static (Tensor indices, Tensor ids, Tensor weights) compute_accidental_hits (Tensor true_classes, Tensor sampled_candidates, int num_true, int? seed = null, int? seed2 = null, string name = "ComputeAccidentalHits")
+ {
+ var dict = new Dictionary();
+ dict["true_classes"] = true_classes;
+ dict["sampled_candidates"] = sampled_candidates;
+ dict["num_true"] = num_true;
+ if (seed.HasValue)
+ dict["seed"] = seed.Value;
+ if (seed2.HasValue)
+ dict["seed2"] = seed2.Value;
+ var op = _op_def_lib._apply_op_helper("ComputeAccidentalHits", name: name, keywords: dict);
+ int _idx = 0;
+ var indices = op.outputs[_idx++];
+ var ids = op.outputs[_idx++];
+ var weights = op.outputs[_idx++];
+ return (indices, ids, weights);
+ }
+
+ ///
+ /// Concatenates tensors along one dimension.
+ ///
+ ///
+ /// 0-D. The dimension along which to concatenate. Must be in the
+ /// range [0, rank(values)).
+ ///
+ ///
+ /// The N Tensors to concatenate. Their ranks and types must match,
+ /// and their sizes must match in all dimensions except concat_dim.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Concat'.
+ ///
+ ///
+ /// A Tensor with the concatenation of values stacked along the
+ /// concat_dim dimension. This tensor's shape matches that of values except
+ /// in concat_dim where it has the sum of the sizes.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor concat (Tensor concat_dim, Tensor[] values, string name = "Concat")
+ {
+ var dict = new Dictionary();
+ dict["concat_dim"] = concat_dim;
+ dict["values"] = values;
+ var op = _op_def_lib._apply_op_helper("Concat", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes offsets of concat inputs within its output.
+ ///
+ ///
+ /// The dimension along which to concatenate.
+ ///
+ ///
+ /// The N int32 vectors representing shape of tensors being concatenated.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ConcatOffset'.
+ ///
+ ///
+ /// The N int32 vectors representing the starting offset
+ /// of input tensors within the concatenated output.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// For example:
+ ///
+ ///
+ /// # 'x' is [2, 2, 7]
+ /// # 'y' is [2, 3, 7]
+ /// # 'z' is [2, 5, 7]
+ /// concat_offset(2, [x, y, z]) => [0, 0, 0], [0, 2, 0], [0, 5, 0]
+ ///
+ ///
+ /// This is typically used by gradient computations for a concat operation.
+ ///
+ public static Tensor[] concat_offset (Tensor concat_dim, Tensor[] shape, string name = "ConcatOffset")
+ {
+ var dict = new Dictionary();
+ dict["concat_dim"] = concat_dim;
+ dict["shape"] = shape;
+ var op = _op_def_lib._apply_op_helper("ConcatOffset", name: name, keywords: dict);
+ int _idx = 0;
+ var offset = Enumerable.Range(0, op.OutputListLength("offset")).Select(_ => op.outputs[_idx++]).ToArray();
+ return (offset);
+ }
+
+ ///
+ /// Concatenates tensors along one dimension.
+ ///
+ ///
+ /// List of N Tensors to concatenate. Their ranks and types must match,
+ /// and their sizes must match in all dimensions except concat_dim.
+ ///
+ ///
+ /// 0-D. The dimension along which to concatenate. Must be in the
+ /// range [-rank(values), rank(values)).
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ConcatV2'.
+ ///
+ ///
+ /// A Tensor with the concatenation of values stacked along the
+ /// concat_dim dimension. This tensor's shape matches that of values except
+ /// in concat_dim where it has the sum of the sizes.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor concat_v2 (Tensor[] values, Tensor axis, string name = "ConcatV2")
+ {
+ var dict = new Dictionary();
+ dict["values"] = values;
+ dict["axis"] = axis;
+ var op = _op_def_lib._apply_op_helper("ConcatV2", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Creates a dataset that concatenates input_dataset with another_dataset.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ConcatenateDataset'.
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor concatenate_dataset (Tensor input_dataset, Tensor another_dataset, TF_DataType[] output_types, TensorShape[] output_shapes, string name = "ConcatenateDataset")
+ {
+ var dict = new Dictionary();
+ dict["input_dataset"] = input_dataset;
+ dict["another_dataset"] = another_dataset;
+ dict["output_types"] = output_types;
+ dict["output_shapes"] = output_shapes;
+ var op = _op_def_lib._apply_op_helper("ConcatenateDataset", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// A conditional accumulator for aggregating gradients.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ConditionalAccumulator'.
+ ///
+ ///
+ /// Optional argument
+ /// The type of the value being accumulated.
+ ///
+ ///
+ /// Optional argument
+ /// The shape of the values, can be [], in which case shape is unknown.
+ ///
+ ///
+ /// If non-empty, this accumulator is placed in the given container.
+ /// Otherwise, a default container is used.
+ ///
+ ///
+ /// If non-empty, this accumulator will be shared under the
+ /// given name across multiple sessions.
+ ///
+ ///
+ /// The handle to the accumulator.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// The accumulator accepts gradients marked with local_step greater or
+ /// equal to the most recent global_step known to the accumulator. The
+ /// average can be extracted from the accumulator, provided sufficient
+ /// gradients have been accumulated. Extracting the average automatically
+ /// resets the aggregate to 0, and increments the global_step recorded by
+ /// the accumulator.
+ ///
+ public static Tensor conditional_accumulator (TF_DataType dtype, TensorShape shape, string container = null, string shared_name = null, string name = "ConditionalAccumulator")
+ {
+ var dict = new Dictionary();
+ dict["dtype"] = dtype;
+ dict["shape"] = shape;
+ if (container != null)
+ dict["container"] = container;
+ if (shared_name != null)
+ dict["shared_name"] = shared_name;
+ var op = _op_def_lib._apply_op_helper("ConditionalAccumulator", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// An op that sets up the centralized structures for a distributed TPU
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ConfigureDistributedTPU'.
+ ///
+ ///
+ /// Reserved. Do not use.
+ ///
+ ///
+ /// Serialized tensorflow.tpu.TPUEmbeddingConfiguration that
+ /// describes the embedding lookups of the program.
+ ///
+ ///
+ /// Reserved. Do not use.
+ ///
+ ///
+ /// A serialized tensorflow.tpu.TopologyProto that describes the TPU
+ /// topology.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// system.
+ ///
+ public static Tensor configure_distributed_t_p_u (string embedding_config = null, string tpu_embedding_config = null, bool? is_global_init = null, string name = "ConfigureDistributedTPU")
+ {
+ var dict = new Dictionary();
+ if (embedding_config != null)
+ dict["embedding_config"] = embedding_config;
+ if (tpu_embedding_config != null)
+ dict["tpu_embedding_config"] = tpu_embedding_config;
+ if (is_global_init.HasValue)
+ dict["is_global_init"] = is_global_init.Value;
+ var op = _op_def_lib._apply_op_helper("ConfigureDistributedTPU", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Returns the complex conjugate of a complex number.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Conj'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Given a tensor input of complex numbers, this operation returns a tensor of
+ /// complex numbers that are the complex conjugate of each element in input. The
+ /// complex numbers in input must be of the form \\(a + bj\\), where *a* is the
+ /// real part and *b* is the imaginary part.
+ ///
+ /// The complex conjugate returned by this operation is of the form \\(a - bj\\).
+ ///
+ /// For example:
+ ///
+ ///
+ /// # tensor 'input' is [-2.25 + 4.75j, 3.25 + 5.75j]
+ /// tf.conj(input) ==> [-2.25 - 4.75j, 3.25 - 5.75j]
+ ///
+ ///
+ public static Tensor conj (Tensor input, string name = "Conj")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ var op = _op_def_lib._apply_op_helper("Conj", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Shuffle dimensions of x according to a permutation and conjugate the result.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ConjugateTranspose'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// The output y has the same rank as x. The shapes of x and y satisfy:
+ /// y.shape[i] == x.shape[perm[i]] for i in [0, 1, ..., rank(x) - 1]
+ /// y[i,j,k,...,s,t,u] == conj(x[perm[i], perm[j], perm[k],...,perm[s], perm[t], perm[u]])
+ ///
+ public static Tensor conjugate_transpose (Tensor x, Tensor perm, string name = "ConjugateTranspose")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ dict["perm"] = perm;
+ var op = _op_def_lib._apply_op_helper("ConjugateTranspose", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Returns a constant tensor.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Const'.
+ ///
+ ///
+ /// Optional argument
+ /// Attr value is the tensor to return.
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor constant (Tensor value, TF_DataType dtype, string name = "Const")
+ {
+ var dict = new Dictionary();
+ dict["value"] = value;
+ dict["dtype"] = dtype;
+ var op = _op_def_lib._apply_op_helper("Const", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// This op consumes a lock created by MutexLock.
+ ///
+ ///
+ /// A tensor returned by MutexLock.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ConsumeMutexLock'.
+ ///
+ ///
+ /// Returns the description of the operation
+ ///
+ ///
+ /// This op exists to consume a tensor created by MutexLock (other than
+ /// direct control dependencies). It should be the only that consumes the tensor,
+ /// and will raise an error if it is not. Its only purpose is to keep the
+ /// mutex lock tensor alive until it is consumed by this op.
+ ///
+ /// **NOTE**: This operation must run on the same device as its input. This may
+ /// be enforced via the colocate_with mechanism.
+ ///
+ public static Operation consume_mutex_lock (Tensor mutex_lock, string name = "ConsumeMutexLock")
+ {
+ var dict = new Dictionary();
+ dict["mutex_lock"] = mutex_lock;
+ var op = _op_def_lib._apply_op_helper("ConsumeMutexLock", name: name, keywords: dict);
+ return op;
+ }
+
+ ///
+ /// Does nothing. Serves as a control trigger for scheduling.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ControlTrigger'.
+ ///
+ ///
+ /// Returns the description of the operation
+ ///
+ ///
+ /// Only useful as a placeholder for control edges.
+ ///
+ public static Operation control_trigger (string name = "ControlTrigger")
+ {
+ var dict = new Dictionary();
+ var op = _op_def_lib._apply_op_helper("ControlTrigger", name: name, keywords: dict);
+ return op;
+ }
+
+ ///
+ /// Computes a 2-D convolution given 4-D input and filter tensors.
+ ///
+ ///
+ /// A 4-D tensor. The dimension order is interpreted according to the value
+ /// of data_format, see below for details.
+ ///
+ ///
+ /// A 4-D tensor of shape
+ /// [filter_height, filter_width, in_channels, out_channels]
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Conv2D'.
+ ///
+ ///
+ /// Optional argument
+ /// 1-D tensor of length 4. The stride of the sliding window for each
+ /// dimension of input. The dimension order is determined by the value of
+ /// data_format, see below for details.
+ ///
+ ///
+ /// Optional argument
+ /// The type of padding algorithm to use.
+ ///
+ ///
+ ///
+ ///
+ /// Specify the data format of the input and output data. With the
+ /// default format "NHWC", the data is stored in the order of:
+ /// [batch, height, width, channels].
+ /// Alternatively, the format could be "NCHW", the data storage order of:
+ /// [batch, channels, height, width].
+ ///
+ ///
+ /// 1-D tensor of length 4. The dilation factor for each dimension of
+ /// input. If set to k > 1, there will be k-1 skipped cells between each
+ /// filter element on that dimension. The dimension order is determined by the
+ /// value of data_format, see above for details. Dilations in the batch and
+ /// depth dimensions must be 1.
+ ///
+ ///
+ /// A 4-D tensor. The dimension order is determined by the value of
+ /// data_format, see below for details.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Given an input tensor of shape [batch, in_height, in_width, in_channels]
+ /// and a filter / kernel tensor of shape
+ /// [filter_height, filter_width, in_channels, out_channels], this op
+ /// performs the following:
+ ///
+ /// 1. Flattens the filter to a 2-D matrix with shape
+ /// [filter_height * filter_width * in_channels, output_channels].
+ /// 2. Extracts image patches from the input tensor to form a *virtual*
+ /// tensor of shape [batch, out_height, out_width,
+ /// filter_height * filter_width * in_channels].
+ /// 3. For each patch, right-multiplies the filter matrix and the image patch
+ /// vector.
+ ///
+ /// In detail, with the default NHWC format,
+ ///
+ /// output[b, i, j, k] =
+ /// sum_{di, dj, q} input[b, strides[1] * i + di, strides[2] * j + dj, q] *
+ /// filter[di, dj, q, k]
+ ///
+ /// Must have strides[0] = strides[3] = 1. For the most common case of the same
+ /// horizontal and vertices strides, strides = [1, stride, stride, 1].
+ ///
+ public static Tensor conv2d (Tensor input, Tensor filter, int[] strides, string padding, bool? use_cudnn_on_gpu = null, string data_format = null, int[] dilations = null, string name = "Conv2D")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["filter"] = filter;
+ dict["strides"] = strides;
+ dict["padding"] = padding;
+ if (use_cudnn_on_gpu.HasValue)
+ dict["use_cudnn_on_gpu"] = use_cudnn_on_gpu.Value;
+ if (data_format != null)
+ dict["data_format"] = data_format;
+ if (dilations != null)
+ dict["dilations"] = dilations;
+ var op = _op_def_lib._apply_op_helper("Conv2D", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes the gradients of convolution with respect to the filter.
+ ///
+ ///
+ /// 4-D with shape [batch, in_height, in_width, in_channels].
+ ///
+ ///
+ /// An integer vector representing the tensor shape of filter,
+ /// where filter is a 4-D
+ /// [filter_height, filter_width, in_channels, out_channels] tensor.
+ ///
+ ///
+ /// 4-D with shape [batch, out_height, out_width, out_channels].
+ /// Gradients w.r.t. the output of the convolution.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Conv2DBackpropFilter'.
+ ///
+ ///
+ /// Optional argument
+ /// The stride of the sliding window for each dimension of the input
+ /// of the convolution. Must be in the same order as the dimension specified with
+ /// format.
+ ///
+ ///
+ /// Optional argument
+ /// The type of padding algorithm to use.
+ ///
+ ///
+ ///
+ ///
+ /// Specify the data format of the input and output data. With the
+ /// default format "NHWC", the data is stored in the order of:
+ /// [batch, in_height, in_width, in_channels].
+ /// Alternatively, the format could be "NCHW", the data storage order of:
+ /// [batch, in_channels, in_height, in_width].
+ ///
+ ///
+ /// 1-D tensor of length 4. The dilation factor for each dimension of
+ /// input. If set to k > 1, there will be k-1 skipped cells between each filter
+ /// element on that dimension. The dimension order is determined by the value of
+ /// data_format, see above for details. Dilations in the batch and depth
+ /// dimensions must be 1.
+ ///
+ ///
+ /// 4-D with shape
+ /// [filter_height, filter_width, in_channels, out_channels]. Gradient w.r.t.
+ /// the filter input of the convolution.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor conv2d_backprop_filter (Tensor input, Tensor filter_sizes, Tensor out_backprop, int[] strides, string padding, bool? use_cudnn_on_gpu = null, string data_format = null, int[] dilations = null, string name = "Conv2DBackpropFilter")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["filter_sizes"] = filter_sizes;
+ dict["out_backprop"] = out_backprop;
+ dict["strides"] = strides;
+ dict["padding"] = padding;
+ if (use_cudnn_on_gpu.HasValue)
+ dict["use_cudnn_on_gpu"] = use_cudnn_on_gpu.Value;
+ if (data_format != null)
+ dict["data_format"] = data_format;
+ if (dilations != null)
+ dict["dilations"] = dilations;
+ var op = _op_def_lib._apply_op_helper("Conv2DBackpropFilter", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes the gradients of convolution with respect to the input.
+ ///
+ ///
+ /// An integer vector representing the shape of input,
+ /// where input is a 4-D [batch, height, width, channels] tensor.
+ ///
+ ///
+ /// 4-D with shape
+ /// [filter_height, filter_width, in_channels, out_channels].
+ ///
+ ///
+ /// 4-D with shape [batch, out_height, out_width, out_channels].
+ /// Gradients w.r.t. the output of the convolution.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Conv2DBackpropInput'.
+ ///
+ ///
+ /// Optional argument
+ /// The stride of the sliding window for each dimension of the input
+ /// of the convolution. Must be in the same order as the dimension specified with
+ /// format.
+ ///
+ ///
+ /// Optional argument
+ /// The type of padding algorithm to use.
+ ///
+ ///
+ ///
+ ///
+ /// Specify the data format of the input and output data. With the
+ /// default format "NHWC", the data is stored in the order of:
+ /// [batch, in_height, in_width, in_channels].
+ /// Alternatively, the format could be "NCHW", the data storage order of:
+ /// [batch, in_channels, in_height, in_width].
+ ///
+ ///
+ /// 1-D tensor of length 4. The dilation factor for each dimension of
+ /// input. If set to k > 1, there will be k-1 skipped cells between each filter
+ /// element on that dimension. The dimension order is determined by the value of
+ /// data_format, see above for details. Dilations in the batch and depth
+ /// dimensions must be 1.
+ ///
+ ///
+ /// 4-D with shape [batch, in_height, in_width, in_channels]. Gradient
+ /// w.r.t. the input of the convolution.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor conv2d_backprop_input (Tensor input_sizes, Tensor filter, Tensor out_backprop, int[] strides, string padding, bool? use_cudnn_on_gpu = null, string data_format = null, int[] dilations = null, string name = "Conv2DBackpropInput")
+ {
+ var dict = new Dictionary();
+ dict["input_sizes"] = input_sizes;
+ dict["filter"] = filter;
+ dict["out_backprop"] = out_backprop;
+ dict["strides"] = strides;
+ dict["padding"] = padding;
+ if (use_cudnn_on_gpu.HasValue)
+ dict["use_cudnn_on_gpu"] = use_cudnn_on_gpu.Value;
+ if (data_format != null)
+ dict["data_format"] = data_format;
+ if (dilations != null)
+ dict["dilations"] = dilations;
+ var op = _op_def_lib._apply_op_helper("Conv2DBackpropInput", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes a 3-D convolution given 5-D input and filter tensors.
+ ///
+ ///
+ /// Shape [batch, in_depth, in_height, in_width, in_channels].
+ ///
+ ///
+ /// Shape [filter_depth, filter_height, filter_width, in_channels,
+ /// out_channels]. in_channels must match between input and filter.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Conv3D'.
+ ///
+ ///
+ /// Optional argument
+ /// 1-D tensor of length 5. The stride of the sliding window for each
+ /// dimension of input. Must have strides[0] = strides[4] = 1.
+ ///
+ ///
+ /// Optional argument
+ /// The type of padding algorithm to use.
+ ///
+ ///
+ /// The data format of the input and output data. With the
+ /// default format "NDHWC", the data is stored in the order of:
+ /// [batch, in_depth, in_height, in_width, in_channels].
+ /// Alternatively, the format could be "NCDHW", the data storage order is:
+ /// [batch, in_channels, in_depth, in_height, in_width].
+ ///
+ ///
+ /// 1-D tensor of length 5. The dilation factor for each dimension of
+ /// input. If set to k > 1, there will be k-1 skipped cells between each
+ /// filter element on that dimension. The dimension order is determined by the
+ /// value of data_format, see above for details. Dilations in the batch and
+ /// depth dimensions must be 1.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// In signal processing, cross-correlation is a measure of similarity of
+ /// two waveforms as a function of a time-lag applied to one of them. This
+ /// is also known as a sliding dot product or sliding inner-product.
+ ///
+ /// Our Conv3D implements a form of cross-correlation.
+ ///
+ public static Tensor conv3d (Tensor input, Tensor filter, int[] strides, string padding, string data_format = null, int[] dilations = null, string name = "Conv3D")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["filter"] = filter;
+ dict["strides"] = strides;
+ dict["padding"] = padding;
+ if (data_format != null)
+ dict["data_format"] = data_format;
+ if (dilations != null)
+ dict["dilations"] = dilations;
+ var op = _op_def_lib._apply_op_helper("Conv3D", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes the gradients of 3-D convolution with respect to the filter.
+ ///
+ ///
+ /// Shape [batch, depth, rows, cols, in_channels].
+ ///
+ ///
+ /// Shape [depth, rows, cols, in_channels, out_channels].
+ /// in_channels must match between input and filter.
+ ///
+ ///
+ /// Backprop signal of shape [batch, out_depth, out_rows, out_cols,
+ /// out_channels].
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Conv3DBackpropFilter'.
+ ///
+ ///
+ /// Optional argument
+ /// 1-D tensor of length 5. The stride of the sliding window for each
+ /// dimension of input. Must have strides[0] = strides[4] = 1.
+ ///
+ ///
+ /// Optional argument
+ /// The type of padding algorithm to use.
+ ///
+ ///
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor conv3d_backprop_filter (Tensor input, Tensor filter, Tensor out_backprop, int[] strides, string padding, int[] dilations = null, string name = "Conv3DBackpropFilter")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["filter"] = filter;
+ dict["out_backprop"] = out_backprop;
+ dict["strides"] = strides;
+ dict["padding"] = padding;
+ if (dilations != null)
+ dict["dilations"] = dilations;
+ var op = _op_def_lib._apply_op_helper("Conv3DBackpropFilter", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes the gradients of 3-D convolution with respect to the filter.
+ ///
+ ///
+ /// Shape [batch, depth, rows, cols, in_channels].
+ ///
+ ///
+ /// An integer vector representing the tensor shape of filter,
+ /// where filter is a 5-D
+ /// [filter_depth, filter_height, filter_width, in_channels, out_channels]
+ /// tensor.
+ ///
+ ///
+ /// Backprop signal of shape [batch, out_depth, out_rows, out_cols,
+ /// out_channels].
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Conv3DBackpropFilterV2'.
+ ///
+ ///
+ /// Optional argument
+ /// 1-D tensor of length 5. The stride of the sliding window for each
+ /// dimension of input. Must have strides[0] = strides[4] = 1.
+ ///
+ ///
+ /// Optional argument
+ /// The type of padding algorithm to use.
+ ///
+ ///
+ /// The data format of the input and output data. With the
+ /// default format "NDHWC", the data is stored in the order of:
+ /// [batch, in_depth, in_height, in_width, in_channels].
+ /// Alternatively, the format could be "NCDHW", the data storage order is:
+ /// [batch, in_channels, in_depth, in_height, in_width].
+ ///
+ ///
+ /// 1-D tensor of length 5. The dilation factor for each dimension of
+ /// input. If set to k > 1, there will be k-1 skipped cells between each
+ /// filter element on that dimension. The dimension order is determined by the
+ /// value of data_format, see above for details. Dilations in the batch and
+ /// depth dimensions must be 1.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor conv3d_backprop_filter_v2 (Tensor input, Tensor filter_sizes, Tensor out_backprop, int[] strides, string padding, string data_format = null, int[] dilations = null, string name = "Conv3DBackpropFilterV2")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["filter_sizes"] = filter_sizes;
+ dict["out_backprop"] = out_backprop;
+ dict["strides"] = strides;
+ dict["padding"] = padding;
+ if (data_format != null)
+ dict["data_format"] = data_format;
+ if (dilations != null)
+ dict["dilations"] = dilations;
+ var op = _op_def_lib._apply_op_helper("Conv3DBackpropFilterV2", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes the gradients of 3-D convolution with respect to the input.
+ ///
+ ///
+ /// Shape [batch, depth, rows, cols, in_channels].
+ ///
+ ///
+ /// Shape [depth, rows, cols, in_channels, out_channels].
+ /// in_channels must match between input and filter.
+ ///
+ ///
+ /// Backprop signal of shape [batch, out_depth, out_rows, out_cols,
+ /// out_channels].
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Conv3DBackpropInput'.
+ ///
+ ///
+ /// Optional argument
+ /// 1-D tensor of length 5. The stride of the sliding window for each
+ /// dimension of input. Must have strides[0] = strides[4] = 1.
+ ///
+ ///
+ /// Optional argument
+ /// The type of padding algorithm to use.
+ ///
+ ///
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor conv3d_backprop_input (Tensor input, Tensor filter, Tensor out_backprop, int[] strides, string padding, int[] dilations = null, string name = "Conv3DBackpropInput")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["filter"] = filter;
+ dict["out_backprop"] = out_backprop;
+ dict["strides"] = strides;
+ dict["padding"] = padding;
+ if (dilations != null)
+ dict["dilations"] = dilations;
+ var op = _op_def_lib._apply_op_helper("Conv3DBackpropInput", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes the gradients of 3-D convolution with respect to the input.
+ ///
+ ///
+ /// An integer vector representing the tensor shape of input,
+ /// where input is a 5-D
+ /// [batch, depth, rows, cols, in_channels] tensor.
+ ///
+ ///
+ /// Shape [depth, rows, cols, in_channels, out_channels].
+ /// in_channels must match between input and filter.
+ ///
+ ///
+ /// Backprop signal of shape [batch, out_depth, out_rows, out_cols,
+ /// out_channels].
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Conv3DBackpropInputV2'.
+ ///
+ ///
+ /// Optional argument
+ /// 1-D tensor of length 5. The stride of the sliding window for each
+ /// dimension of input. Must have strides[0] = strides[4] = 1.
+ ///
+ ///
+ /// Optional argument
+ /// The type of padding algorithm to use.
+ ///
+ ///
+ /// The data format of the input and output data. With the
+ /// default format "NDHWC", the data is stored in the order of:
+ /// [batch, in_depth, in_height, in_width, in_channels].
+ /// Alternatively, the format could be "NCDHW", the data storage order is:
+ /// [batch, in_channels, in_depth, in_height, in_width].
+ ///
+ ///
+ /// 1-D tensor of length 5. The dilation factor for each dimension of
+ /// input. If set to k > 1, there will be k-1 skipped cells between each
+ /// filter element on that dimension. The dimension order is determined by the
+ /// value of data_format, see above for details. Dilations in the batch and
+ /// depth dimensions must be 1.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor conv3d_backprop_input_v2 (Tensor input_sizes, Tensor filter, Tensor out_backprop, int[] strides, string padding, string data_format = null, int[] dilations = null, string name = "Conv3DBackpropInputV2")
+ {
+ var dict = new Dictionary();
+ dict["input_sizes"] = input_sizes;
+ dict["filter"] = filter;
+ dict["out_backprop"] = out_backprop;
+ dict["strides"] = strides;
+ dict["padding"] = padding;
+ if (data_format != null)
+ dict["data_format"] = data_format;
+ if (dilations != null)
+ dict["dilations"] = dilations;
+ var op = _op_def_lib._apply_op_helper("Conv3DBackpropInputV2", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Copy Op.
+ ///
+ ///
+ /// Input tensor.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Copy'.
+ ///
+ ///
+ /// The name of the input tensor.
+ ///
+ ///
+ /// A list of debug op spec (op, url, gated_grpc) for attached debug
+ /// ops. Each element of the list has the format
+ /// <debug_op>;<grpc_url>;<gated_grpc>, wherein gated_grpc is boolean represented
+ /// as 0/1. E.g., "DebugIdentity;grpc://foo:3333;1",
+ /// "DebugIdentity;file:///tmp/tfdbg_1;0".
+ ///
+ ///
+ /// Output tensor, deep-copied from input.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Performs CPU-to-CPU or GPU-to-GPU deep-copying of tensor, depending on the
+ /// device on which the tensor is allocated.
+ /// N.B.: If the all downstream attached debug ops are disabled given the current
+ /// gRPC gating status, the output will simply forward the input tensor without
+ /// deep-copying. See the documentation of Debug* ops for more details.
+ ///
+ /// Unlike the CopyHost Op, this op does not have HostMemory constraint on its
+ /// input or output.
+ ///
+ public static Tensor copy (Tensor input, string tensor_name = null, string[] debug_ops_spec = null, string name = "Copy")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ if (tensor_name != null)
+ dict["tensor_name"] = tensor_name;
+ if (debug_ops_spec != null)
+ dict["debug_ops_spec"] = debug_ops_spec;
+ var op = _op_def_lib._apply_op_helper("Copy", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Copy Host Op.
+ ///
+ ///
+ /// Input tensor.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CopyHost'.
+ ///
+ ///
+ /// The name of the input tensor.
+ ///
+ ///
+ /// A list of debug op spec (op, url, gated_grpc) for attached debug
+ /// ops. Each element of the list has the format
+ /// <debug_op>;<grpc_url>;<gated_grpc>, wherein gated_grpc is boolean represented
+ /// as 0/1. E.g., "DebugIdentity;grpc://foo:3333;1",
+ /// "DebugIdentity;file:///tmp/tfdbg_1;0".
+ ///
+ ///
+ /// Output tensor, deep-copied from input.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Performs CPU-to-CPU deep-copying of tensor.
+ /// N.B.: If the all downstream attached debug ops are disabled given the current
+ /// gRPC gating status, the output will simply forward the input tensor without
+ /// deep-copying. See the documentation of Debug* ops for more details.
+ ///
+ /// Unlike the Copy Op, this op has HostMemory constraint on its input or output.
+ ///
+ public static Tensor copy_host (Tensor input, string tensor_name = null, string[] debug_ops_spec = null, string name = "CopyHost")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ if (tensor_name != null)
+ dict["tensor_name"] = tensor_name;
+ if (debug_ops_spec != null)
+ dict["debug_ops_spec"] = debug_ops_spec;
+ var op = _op_def_lib._apply_op_helper("CopyHost", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes cos of x element-wise.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Cos'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor cos (Tensor x, string name = "Cos")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ var op = _op_def_lib._apply_op_helper("Cos", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes hyperbolic cosine of x element-wise.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Cosh'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor cosh (Tensor x, string name = "Cosh")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ var op = _op_def_lib._apply_op_helper("Cosh", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Increments 'ref' until it reaches 'limit'.
+ ///
+ ///
+ /// Should be from a scalar Variable node.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CountUpTo'.
+ ///
+ ///
+ /// Optional argument
+ /// If incrementing ref would bring it above limit, instead generates an
+ /// 'OutOfRange' error.
+ ///
+ ///
+ /// A copy of the input before increment. If nothing else modifies the
+ /// input, the values produced will all be distinct.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor count_up_to (Tensor referecne, int limit, string name = "CountUpTo")
+ {
+ var dict = new Dictionary();
+ dict["ref"] = referecne;
+ dict["limit"] = limit;
+ var op = _op_def_lib._apply_op_helper("CountUpTo", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Extracts crops from the input image tensor and resizes them.
+ ///
+ ///
+ /// A 4-D tensor of shape [batch, image_height, image_width, depth].
+ /// Both image_height and image_width need to be positive.
+ ///
+ ///
+ /// A 2-D tensor of shape [num_boxes, 4]. The i-th row of the tensor
+ /// specifies the coordinates of a box in the box_ind[i] image and is specified
+ /// in normalized coordinates [y1, x1, y2, x2]. A normalized coordinate value of
+ /// y is mapped to the image coordinate at y * (image_height - 1), so as the
+ /// [0, 1] interval of normalized image height is mapped to
+ /// [0, image_height - 1] in image height coordinates. We do allow y1 > y2, in
+ /// which case the sampled crop is an up-down flipped version of the original
+ /// image. The width dimension is treated similarly. Normalized coordinates
+ /// outside the [0, 1] range are allowed, in which case we use
+ /// extrapolation_value to extrapolate the input image values.
+ ///
+ ///
+ /// A 1-D tensor of shape [num_boxes] with int32 values in [0, batch).
+ /// The value of box_ind[i] specifies the image that the i-th box refers to.
+ ///
+ ///
+ /// A 1-D tensor of 2 elements, size = [crop_height, crop_width]. All
+ /// cropped image patches are resized to this size. The aspect ratio of the image
+ /// content is not preserved. Both crop_height and crop_width need to be
+ /// positive.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CropAndResize'.
+ ///
+ ///
+ /// A string specifying the sampling method for resizing. It can be either
+ /// "bilinear" or "nearest" and default to "bilinear". Currently two sampling
+ /// methods are supported: Bilinear and Nearest Neighbor.
+ ///
+ ///
+ /// Value used for extrapolation, when applicable.
+ ///
+ ///
+ /// A 4-D tensor of shape [num_boxes, crop_height, crop_width, depth].
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Extracts crops from the input image tensor and resizes them using bilinear
+ /// sampling or nearest neighbor sampling (possibly with aspect ratio change) to a
+ /// common output size specified by crop_size. This is more general than the
+ /// crop_to_bounding_box op which extracts a fixed size slice from the input image
+ /// and does not allow resizing or aspect ratio change.
+ ///
+ /// Returns a tensor with crops from the input image at positions defined at the
+ /// bounding box locations in boxes. The cropped boxes are all resized (with
+ /// bilinear or nearest neighbor interpolation) to a fixed
+ /// size = [crop_height, crop_width]. The result is a 4-D tensor
+ /// [num_boxes, crop_height, crop_width, depth]. The resizing is corner aligned.
+ /// In particular, if boxes = [[0, 0, 1, 1]], the method will give identical
+ /// results to using tf.image.resize_bilinear() or
+ /// tf.image.resize_nearest_neighbor()(depends on the method argument) with
+ /// align_corners=True.
+ ///
+ public static Tensor crop_and_resize (Tensor image, Tensor boxes, Tensor box_ind, Tensor crop_size, string method = null, float? extrapolation_value = null, string name = "CropAndResize")
+ {
+ var dict = new Dictionary();
+ dict["image"] = image;
+ dict["boxes"] = boxes;
+ dict["box_ind"] = box_ind;
+ dict["crop_size"] = crop_size;
+ if (method != null)
+ dict["method"] = method;
+ if (extrapolation_value.HasValue)
+ dict["extrapolation_value"] = extrapolation_value.Value;
+ var op = _op_def_lib._apply_op_helper("CropAndResize", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes the gradient of the crop_and_resize op wrt the input boxes tensor.
+ ///
+ ///
+ /// A 4-D tensor of shape [num_boxes, crop_height, crop_width, depth].
+ ///
+ ///
+ /// A 4-D tensor of shape [batch, image_height, image_width, depth].
+ /// Both image_height and image_width need to be positive.
+ ///
+ ///
+ /// A 2-D tensor of shape [num_boxes, 4]. The i-th row of the tensor
+ /// specifies the coordinates of a box in the box_ind[i] image and is specified
+ /// in normalized coordinates [y1, x1, y2, x2]. A normalized coordinate value of
+ /// y is mapped to the image coordinate at y * (image_height - 1), so as the
+ /// [0, 1] interval of normalized image height is mapped to
+ /// [0, image_height - 1] in image height coordinates. We do allow y1 > y2, in
+ /// which case the sampled crop is an up-down flipped version of the original
+ /// image. The width dimension is treated similarly. Normalized coordinates
+ /// outside the [0, 1] range are allowed, in which case we use
+ /// extrapolation_value to extrapolate the input image values.
+ ///
+ ///
+ /// A 1-D tensor of shape [num_boxes] with int32 values in [0, batch).
+ /// The value of box_ind[i] specifies the image that the i-th box refers to.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CropAndResizeGradBoxes'.
+ ///
+ ///
+ /// A string specifying the interpolation method. Only 'bilinear' is
+ /// supported for now.
+ ///
+ ///
+ /// A 2-D tensor of shape [num_boxes, 4].
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor crop_and_resize_grad_boxes (Tensor grads, Tensor image, Tensor boxes, Tensor box_ind, string method = null, string name = "CropAndResizeGradBoxes")
+ {
+ var dict = new Dictionary();
+ dict["grads"] = grads;
+ dict["image"] = image;
+ dict["boxes"] = boxes;
+ dict["box_ind"] = box_ind;
+ if (method != null)
+ dict["method"] = method;
+ var op = _op_def_lib._apply_op_helper("CropAndResizeGradBoxes", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes the gradient of the crop_and_resize op wrt the input image tensor.
+ ///
+ ///
+ /// A 4-D tensor of shape [num_boxes, crop_height, crop_width, depth].
+ ///
+ ///
+ /// A 2-D tensor of shape [num_boxes, 4]. The i-th row of the tensor
+ /// specifies the coordinates of a box in the box_ind[i] image and is specified
+ /// in normalized coordinates [y1, x1, y2, x2]. A normalized coordinate value of
+ /// y is mapped to the image coordinate at y * (image_height - 1), so as the
+ /// [0, 1] interval of normalized image height is mapped to
+ /// [0, image_height - 1] in image height coordinates. We do allow y1 > y2, in
+ /// which case the sampled crop is an up-down flipped version of the original
+ /// image. The width dimension is treated similarly. Normalized coordinates
+ /// outside the [0, 1] range are allowed, in which case we use
+ /// extrapolation_value to extrapolate the input image values.
+ ///
+ ///
+ /// A 1-D tensor of shape [num_boxes] with int32 values in [0, batch).
+ /// The value of box_ind[i] specifies the image that the i-th box refers to.
+ ///
+ ///
+ /// A 1-D tensor with value [batch, image_height, image_width, depth]
+ /// containing the original image size. Both image_height and image_width need
+ /// to be positive.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CropAndResizeGradImage'.
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// A string specifying the interpolation method. Only 'bilinear' is
+ /// supported for now.
+ ///
+ ///
+ /// A 4-D tensor of shape [batch, image_height, image_width, depth].
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor crop_and_resize_grad_image (Tensor grads, Tensor boxes, Tensor box_ind, Tensor image_size, TF_DataType T, string method = null, string name = "CropAndResizeGradImage")
+ {
+ var dict = new Dictionary();
+ dict["grads"] = grads;
+ dict["boxes"] = boxes;
+ dict["box_ind"] = box_ind;
+ dict["image_size"] = image_size;
+ dict["T"] = T;
+ if (method != null)
+ dict["method"] = method;
+ var op = _op_def_lib._apply_op_helper("CropAndResizeGradImage", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Compute the pairwise cross product.
+ ///
+ ///
+ /// A tensor containing 3-element vectors.
+ ///
+ ///
+ /// Another tensor, of same type and shape as a.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Cross'.
+ ///
+ ///
+ /// Pairwise cross product of the vectors in a and b.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// a and b must be the same shape; they can either be simple 3-element vectors,
+ /// or any shape where the innermost dimension is 3. In the latter case, each pair
+ /// of corresponding 3-element vectors is cross-multiplied independently.
+ ///
+ public static Tensor cross (Tensor a, Tensor b, string name = "Cross")
+ {
+ var dict = new Dictionary();
+ dict["a"] = a;
+ dict["b"] = b;
+ var op = _op_def_lib._apply_op_helper("Cross", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// An Op to sum inputs across replicated TPU instances. Each
+ ///
+ ///
+ /// The local input to the sum.
+ ///
+ ///
+ /// An int32 tensor with shape
+ /// [num_groups, num_replicas_per_group]. group_assignment[i] represents the
+ /// replica ids in the ith subgroup.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CrossReplicaSum'.
+ ///
+ ///
+ /// The sum of all the distributed inputs.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// instance supplies its own input. If group_assignment is empty, the output of
+ /// each is the sum of all the inputs, otherwise the output of each is the sum of
+ /// the inputs belonging to the same group.
+ ///
+ /// For example, suppose there are 8 TPU instances: [A, B, C, D, E, F, G, H].
+ /// Passing group_assignment=[[0,2,4,6],[1,3,5,7]] sets A, C, E, G as group 0,
+ /// and B, D, F, H as group 1. Thus we get the outputs:
+ /// [A+C+E+G, B+D+F+H, A+C+E+G, B+D+F+H, A+C+E+G, B+D+F+H, A+C+E+G, B+D+F+H].
+ ///
+ public static Tensor cross_replica_sum (Tensor input, Tensor group_assignment, string name = "CrossReplicaSum")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["group_assignment"] = group_assignment;
+ var op = _op_def_lib._apply_op_helper("CrossReplicaSum", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// A RNN backed by cuDNN.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CudnnRNN'.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Returns a tuple with multiple values, as follows:
+ /// output :
+ /// output_h :
+ /// output_c :
+ /// reserve_space :
+ /// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
+ ///
+ ///
+ /// Computes the RNN from the input and initial states, with respect to the params
+ /// buffer.
+ ///
+ /// rnn_mode: Indicates the type of the RNN model.
+ /// input_mode: Indicate whether there is a linear projection between the input and
+ /// the actual computation before the first layer. 'skip_input' is only allowed
+ /// when input_size == num_units; 'auto_select' implies 'skip_input' when
+ /// input_size == num_units; otherwise, it implies 'linear_input'.
+ /// direction: Indicates whether a bidirectional model will be used. Should be
+ /// "unidirectional" or "bidirectional".
+ /// dropout: Dropout probability. When set to 0., dropout is disabled.
+ /// seed: The 1st part of a seed to initialize dropout.
+ /// seed2: The 2nd part of a seed to initialize dropout.
+ /// input: A 3-D tensor with the shape of [seq_length, batch_size, input_size].
+ /// input_h: A 3-D tensor with the shape of [num_layer * dir, batch_size,
+ /// num_units].
+ /// input_c: For LSTM, a 3-D tensor with the shape of
+ /// [num_layer * dir, batch, num_units]. For other models, it is ignored.
+ /// params: A 1-D tensor that contains the weights and biases in an opaque layout.
+ /// The size must be created through CudnnRNNParamsSize, and initialized
+ /// separately. Note that they might not be compatible across different
+ /// generations. So it is a good idea to save and restore
+ /// output: A 3-D tensor with the shape of [seq_length, batch_size,
+ /// dir * num_units].
+ /// output_h: The same shape has input_h.
+ /// output_c: The same shape as input_c for LSTM. An empty tensor for other models.
+ /// is_training: Indicates whether this operation is used for inferenece or
+ /// training.
+ /// reserve_space: An opaque tensor that can be used in backprop calculation. It
+ /// is only produced if is_training is false.
+ ///
+ public static (Tensor output, Tensor output_h, Tensor output_c, Tensor reserve_space) cudnn_r_n_n (Tensor input, Tensor input_h, Tensor input_c, Tensor parameters, string rnn_mode = null, string input_mode = null, string direction = null, float? dropout = null, int? seed = null, int? seed2 = null, bool? is_training = null, string name = "CudnnRNN")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["input_h"] = input_h;
+ dict["input_c"] = input_c;
+ dict["params"] = parameters;
+ if (rnn_mode != null)
+ dict["rnn_mode"] = rnn_mode;
+ if (input_mode != null)
+ dict["input_mode"] = input_mode;
+ if (direction != null)
+ dict["direction"] = direction;
+ if (dropout.HasValue)
+ dict["dropout"] = dropout.Value;
+ if (seed.HasValue)
+ dict["seed"] = seed.Value;
+ if (seed2.HasValue)
+ dict["seed2"] = seed2.Value;
+ if (is_training.HasValue)
+ dict["is_training"] = is_training.Value;
+ var op = _op_def_lib._apply_op_helper("CudnnRNN", name: name, keywords: dict);
+ int _idx = 0;
+ var output = op.outputs[_idx++];
+ var output_h = op.outputs[_idx++];
+ var output_c = op.outputs[_idx++];
+ var reserve_space = op.outputs[_idx++];
+ return (output, output_h, output_c, reserve_space);
+ }
+
+ ///
+ /// Backprop step of CudnnRNN.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CudnnRNNBackprop'.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Returns a tuple with multiple values, as follows:
+ /// input_backprop :
+ /// input_h_backprop :
+ /// input_c_backprop :
+ /// params_backprop :
+ /// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
+ ///
+ ///
+ /// Compute the backprop of both data and weights in a RNN.
+ ///
+ /// rnn_mode: Indicates the type of the RNN model.
+ /// input_mode: Indicate whether there is a linear projection between the input and
+ /// the actual computation before the first layer. 'skip_input' is only allowed
+ /// when input_size == num_units; 'auto_select' implies 'skip_input' when
+ /// input_size == num_units; otherwise, it implies 'linear_input'.
+ /// direction: Indicates whether a bidirectional model will be used. Should be
+ /// "unidirectional" or "bidirectional".
+ /// dropout: Dropout probability. When set to 0., dropout is disabled.
+ /// seed: The 1st part of a seed to initialize dropout.
+ /// seed2: The 2nd part of a seed to initialize dropout.
+ /// input: A 3-D tensor with the shape of [seq_length, batch_size, input_size].
+ /// input_h: A 3-D tensor with the shape of [num_layer * dir, batch_size,
+ /// num_units].
+ /// input_c: For LSTM, a 3-D tensor with the shape of
+ /// [num_layer * dir, batch, num_units]. For other models, it is ignored.
+ /// params: A 1-D tensor that contains the weights and biases in an opaque layout.
+ /// The size must be created through CudnnRNNParamsSize, and initialized
+ /// separately. Note that they might not be compatible across different
+ /// generations. So it is a good idea to save and restore
+ /// output: A 3-D tensor with the shape of [seq_length, batch_size,
+ /// dir * num_units].
+ /// output_h: The same shape has input_h.
+ /// output_c: The same shape as input_c for LSTM. An empty tensor for other models.
+ /// output_backprop: A 3-D tensor with the same shape as output in the forward pass.
+ /// output_h_backprop: A 3-D tensor with the same shape as output_h in the forward
+ /// pass.
+ /// output_c_backprop: A 3-D tensor with the same shape as output_c in the forward
+ /// pass.
+ /// reserve_space: The same reserve_space produced in for forward operation.
+ /// input_backprop: The backprop to input in the forward pass. Has the same shape
+ /// as input.
+ /// input_h_backprop: The backprop to input_h in the forward pass. Has the same
+ /// shape as input_h.
+ /// input_c_backprop: The backprop to input_c in the forward pass. Has the same
+ /// shape as input_c.
+ /// params_backprop: The backprop to the params buffer in the forward pass. Has the
+ /// same shape as params.
+ ///
+ public static (Tensor input_backprop, Tensor input_h_backprop, Tensor input_c_backprop, Tensor params_backprop) cudnn_r_n_n_backprop (Tensor input, Tensor input_h, Tensor input_c, Tensor parameters, Tensor output, Tensor output_h, Tensor output_c, Tensor output_backprop, Tensor output_h_backprop, Tensor output_c_backprop, Tensor reserve_space, string rnn_mode = null, string input_mode = null, string direction = null, float? dropout = null, int? seed = null, int? seed2 = null, string name = "CudnnRNNBackprop")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["input_h"] = input_h;
+ dict["input_c"] = input_c;
+ dict["params"] = parameters;
+ dict["output"] = output;
+ dict["output_h"] = output_h;
+ dict["output_c"] = output_c;
+ dict["output_backprop"] = output_backprop;
+ dict["output_h_backprop"] = output_h_backprop;
+ dict["output_c_backprop"] = output_c_backprop;
+ dict["reserve_space"] = reserve_space;
+ if (rnn_mode != null)
+ dict["rnn_mode"] = rnn_mode;
+ if (input_mode != null)
+ dict["input_mode"] = input_mode;
+ if (direction != null)
+ dict["direction"] = direction;
+ if (dropout.HasValue)
+ dict["dropout"] = dropout.Value;
+ if (seed.HasValue)
+ dict["seed"] = seed.Value;
+ if (seed2.HasValue)
+ dict["seed2"] = seed2.Value;
+ var op = _op_def_lib._apply_op_helper("CudnnRNNBackprop", name: name, keywords: dict);
+ int _idx = 0;
+ var input_backprop = op.outputs[_idx++];
+ var input_h_backprop = op.outputs[_idx++];
+ var input_c_backprop = op.outputs[_idx++];
+ var params_backprop = op.outputs[_idx++];
+ return (input_backprop, input_h_backprop, input_c_backprop, params_backprop);
+ }
+
+ ///
+ /// Backprop step of CudnnRNN.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CudnnRNNBackpropV2'.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Returns a tuple with multiple values, as follows:
+ /// input_backprop :
+ /// input_h_backprop :
+ /// input_c_backprop :
+ /// params_backprop :
+ /// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
+ ///
+ ///
+ /// Compute the backprop of both data and weights in a RNN. Takes an extra
+ /// "host_reserved" inupt than CudnnRNNBackprop, which is used to determine RNN
+ /// cudnnRNNAlgo_t and cudnnMathType_t.
+ ///
+ /// rnn_mode: Indicates the type of the RNN model.
+ /// input_mode: Indicates whether there is a linear projection between the input and
+ /// the actual computation before the first layer. 'skip_input' is only allowed
+ /// when input_size == num_units; 'auto_select' implies 'skip_input' when
+ /// input_size == num_units; otherwise, it implies 'linear_input'.
+ /// direction: Indicates whether a bidirectional model will be used. Should be
+ /// "unidirectional" or "bidirectional".
+ /// dropout: Dropout probability. When set to 0., dropout is disabled.
+ /// seed: The 1st part of a seed to initialize dropout.
+ /// seed2: The 2nd part of a seed to initialize dropout.
+ /// input: A 3-D tensor with the shape of [seq_length, batch_size, input_size].
+ /// input_h: A 3-D tensor with the shape of [num_layer * dir, batch_size,
+ /// num_units].
+ /// input_c: For LSTM, a 3-D tensor with the shape of
+ /// [num_layer * dir, batch, num_units]. For other models, it is ignored.
+ /// params: A 1-D tensor that contains the weights and biases in an opaque layout.
+ /// The size must be created through CudnnRNNParamsSize, and initialized
+ /// separately. Note that they might not be compatible across different
+ /// generations. So it is a good idea to save and restore
+ /// output: A 3-D tensor with the shape of [seq_length, batch_size,
+ /// dir * num_units].
+ /// output_h: The same shape has input_h.
+ /// output_c: The same shape as input_c for LSTM. An empty tensor for other models.
+ /// output_backprop: A 3-D tensor with the same shape as output in the forward pass.
+ /// output_h_backprop: A 3-D tensor with the same shape as output_h in the forward
+ /// pass.
+ /// output_c_backprop: A 3-D tensor with the same shape as output_c in the forward
+ /// pass.
+ /// reserve_space: The same reserve_space produced in the forward operation.
+ /// host_reserved: The same host_reserved produced in the forward operation.
+ /// input_backprop: The backprop to input in the forward pass. Has the same shape
+ /// as input.
+ /// input_h_backprop: The backprop to input_h in the forward pass. Has the same
+ /// shape as input_h.
+ /// input_c_backprop: The backprop to input_c in the forward pass. Has the same
+ /// shape as input_c.
+ /// params_backprop: The backprop to the params buffer in the forward pass. Has the
+ /// same shape as params.
+ ///
+ public static (Tensor input_backprop, Tensor input_h_backprop, Tensor input_c_backprop, Tensor params_backprop) cudnn_r_n_n_backprop_v2 (Tensor input, Tensor input_h, Tensor input_c, Tensor parameters, Tensor output, Tensor output_h, Tensor output_c, Tensor output_backprop, Tensor output_h_backprop, Tensor output_c_backprop, Tensor reserve_space, Tensor host_reserved, string rnn_mode = null, string input_mode = null, string direction = null, float? dropout = null, int? seed = null, int? seed2 = null, string name = "CudnnRNNBackpropV2")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["input_h"] = input_h;
+ dict["input_c"] = input_c;
+ dict["params"] = parameters;
+ dict["output"] = output;
+ dict["output_h"] = output_h;
+ dict["output_c"] = output_c;
+ dict["output_backprop"] = output_backprop;
+ dict["output_h_backprop"] = output_h_backprop;
+ dict["output_c_backprop"] = output_c_backprop;
+ dict["reserve_space"] = reserve_space;
+ dict["host_reserved"] = host_reserved;
+ if (rnn_mode != null)
+ dict["rnn_mode"] = rnn_mode;
+ if (input_mode != null)
+ dict["input_mode"] = input_mode;
+ if (direction != null)
+ dict["direction"] = direction;
+ if (dropout.HasValue)
+ dict["dropout"] = dropout.Value;
+ if (seed.HasValue)
+ dict["seed"] = seed.Value;
+ if (seed2.HasValue)
+ dict["seed2"] = seed2.Value;
+ var op = _op_def_lib._apply_op_helper("CudnnRNNBackpropV2", name: name, keywords: dict);
+ int _idx = 0;
+ var input_backprop = op.outputs[_idx++];
+ var input_h_backprop = op.outputs[_idx++];
+ var input_c_backprop = op.outputs[_idx++];
+ var params_backprop = op.outputs[_idx++];
+ return (input_backprop, input_h_backprop, input_c_backprop, params_backprop);
+ }
+
+ ///
+ /// Converts CudnnRNN params from canonical form to usable form.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CudnnRNNCanonicalToParams'.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Writes a set of weights into the opaque params buffer so they can be used in
+ /// upcoming training or inferences.
+ ///
+ /// Note that the params buffer may not be compatible across different GPUs. So any
+ /// save and restoration should be converted to and from the canonical weights and
+ /// biases.
+ ///
+ /// num_layers: Specifies the number of layers in the RNN model.
+ /// num_units: Specifies the size of the hidden state.
+ /// input_size: Specifies the size of the input state.
+ /// weights: the canonical form of weights that can be used for saving
+ /// and restoration. They are more likely to be compatible across different
+ /// generations.
+ /// biases: the canonical form of biases that can be used for saving
+ /// and restoration. They are more likely to be compatible across different
+ /// generations.
+ /// num_params: number of parameter sets for all layers.
+ /// Each layer may contain multiple parameter sets, with each set consisting of
+ /// a weight matrix and a bias vector.
+ /// rnn_mode: Indicates the type of the RNN model.
+ /// input_mode: Indicate whether there is a linear projection between the input and
+ /// The actual computation before the first layer. 'skip_input' is only allowed
+ /// when input_size == num_units; 'auto_select' implies 'skip_input' when
+ /// input_size == num_units; otherwise, it implies 'linear_input'.
+ /// direction: Indicates whether a bidirectional model will be used.
+ /// dir = (direction == bidirectional) ? 2 : 1
+ /// dropout: dropout probability. When set to 0., dropout is disabled.
+ /// seed: the 1st part of a seed to initialize dropout.
+ /// seed2: the 2nd part of a seed to initialize dropout.
+ ///
+ public static Tensor cudnn_r_n_n_canonical_to_params (Tensor num_layers, Tensor num_units, Tensor input_size, Tensor[] weights, Tensor[] biases, string rnn_mode = null, string input_mode = null, string direction = null, float? dropout = null, int? seed = null, int? seed2 = null, string name = "CudnnRNNCanonicalToParams")
+ {
+ var dict = new Dictionary();
+ dict["num_layers"] = num_layers;
+ dict["num_units"] = num_units;
+ dict["input_size"] = input_size;
+ dict["weights"] = weights;
+ dict["biases"] = biases;
+ if (rnn_mode != null)
+ dict["rnn_mode"] = rnn_mode;
+ if (input_mode != null)
+ dict["input_mode"] = input_mode;
+ if (direction != null)
+ dict["direction"] = direction;
+ if (dropout.HasValue)
+ dict["dropout"] = dropout.Value;
+ if (seed.HasValue)
+ dict["seed"] = seed.Value;
+ if (seed2.HasValue)
+ dict["seed2"] = seed2.Value;
+ var op = _op_def_lib._apply_op_helper("CudnnRNNCanonicalToParams", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes size of weights that can be used by a Cudnn RNN model.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CudnnRNNParamsSize'.
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Return the params size that can be used by the Cudnn RNN model. Subsequent
+ /// weight allocation and initialization should use this size.
+ ///
+ /// num_layers: Specifies the number of layers in the RNN model.
+ /// num_units: Specifies the size of the hidden state.
+ /// input_size: Specifies the size of the input state.
+ /// rnn_mode: Indicates the type of the RNN model.
+ /// input_mode: Indicate whether there is a linear projection between the input and
+ /// The actual computation before the first layer. 'skip_input' is only allowed
+ /// when input_size == num_units; 'auto_select' implies 'skip_input' when
+ /// input_size == num_units; otherwise, it implies 'linear_input'.
+ /// direction: Indicates whether a bidirectional model will be used.
+ /// dir = (direction == bidirectional) ? 2 : 1
+ /// dropout: dropout probability. When set to 0., dropout is disabled.
+ /// seed: the 1st part of a seed to initialize dropout.
+ /// seed2: the 2nd part of a seed to initialize dropout.
+ /// params_size: The size of the params buffer that should be allocated and
+ /// initialized for this RNN model. Note that this params buffer may not be
+ /// compatible across GPUs. Please use CudnnRNNParamsWeights and
+ /// CudnnRNNParamsBiases to save and restore them in a way that is compatible
+ /// across different runs.
+ ///
+ public static Tensor cudnn_r_n_n_params_size (Tensor num_layers, Tensor num_units, Tensor input_size, TF_DataType T, TF_DataType S, string rnn_mode = null, string input_mode = null, string direction = null, float? dropout = null, int? seed = null, int? seed2 = null, string name = "CudnnRNNParamsSize")
+ {
+ var dict = new Dictionary();
+ dict["num_layers"] = num_layers;
+ dict["num_units"] = num_units;
+ dict["input_size"] = input_size;
+ dict["T"] = T;
+ dict["S"] = S;
+ if (rnn_mode != null)
+ dict["rnn_mode"] = rnn_mode;
+ if (input_mode != null)
+ dict["input_mode"] = input_mode;
+ if (direction != null)
+ dict["direction"] = direction;
+ if (dropout.HasValue)
+ dict["dropout"] = dropout.Value;
+ if (seed.HasValue)
+ dict["seed"] = seed.Value;
+ if (seed2.HasValue)
+ dict["seed2"] = seed2.Value;
+ var op = _op_def_lib._apply_op_helper("CudnnRNNParamsSize", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Retrieves CudnnRNN params in canonical form.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CudnnRNNParamsToCanonical'.
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Returns a tuple with multiple values, as follows:
+ /// weights :
+ /// biases :
+ /// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
+ ///
+ ///
+ /// Retrieves a set of weights from the opaque params buffer that can be saved and
+ /// restored in a way compatible with future runs.
+ ///
+ /// Note that the params buffer may not be compatible across different GPUs. So any
+ /// save and restoration should be converted to and from the canonical weights and
+ /// biases.
+ ///
+ /// num_layers: Specifies the number of layers in the RNN model.
+ /// num_units: Specifies the size of the hidden state.
+ /// input_size: Specifies the size of the input state.
+ /// num_params: number of parameter sets for all layers.
+ /// Each layer may contain multiple parameter sets, with each set consisting of
+ /// a weight matrix and a bias vector.
+ /// weights: the canonical form of weights that can be used for saving
+ /// and restoration. They are more likely to be compatible across different
+ /// generations.
+ /// biases: the canonical form of biases that can be used for saving
+ /// and restoration. They are more likely to be compatible across different
+ /// generations.
+ /// rnn_mode: Indicates the type of the RNN model.
+ /// input_mode: Indicate whether there is a linear projection between the input and
+ /// The actual computation before the first layer. 'skip_input' is only allowed
+ /// when input_size == num_units; 'auto_select' implies 'skip_input' when
+ /// input_size == num_units; otherwise, it implies 'linear_input'.
+ /// direction: Indicates whether a bidirectional model will be used.
+ /// dir = (direction == bidirectional) ? 2 : 1
+ /// dropout: dropout probability. When set to 0., dropout is disabled.
+ /// seed: the 1st part of a seed to initialize dropout.
+ /// seed2: the 2nd part of a seed to initialize dropout.
+ ///
+ public static (Tensor[] weights, Tensor[] biases) cudnn_r_n_n_params_to_canonical (Tensor num_layers, Tensor num_units, Tensor input_size, Tensor parameters, int num_params, string rnn_mode = null, string input_mode = null, string direction = null, float? dropout = null, int? seed = null, int? seed2 = null, string name = "CudnnRNNParamsToCanonical")
+ {
+ var dict = new Dictionary();
+ dict["num_layers"] = num_layers;
+ dict["num_units"] = num_units;
+ dict["input_size"] = input_size;
+ dict["params"] = parameters;
+ dict["num_params"] = num_params;
+ if (rnn_mode != null)
+ dict["rnn_mode"] = rnn_mode;
+ if (input_mode != null)
+ dict["input_mode"] = input_mode;
+ if (direction != null)
+ dict["direction"] = direction;
+ if (dropout.HasValue)
+ dict["dropout"] = dropout.Value;
+ if (seed.HasValue)
+ dict["seed"] = seed.Value;
+ if (seed2.HasValue)
+ dict["seed2"] = seed2.Value;
+ var op = _op_def_lib._apply_op_helper("CudnnRNNParamsToCanonical", name: name, keywords: dict);
+ int _idx = 0;
+ var weights = Enumerable.Range(0, op.OutputListLength("weights")).Select(_ => op.outputs[_idx++]).ToArray();
+ var biases = Enumerable.Range(0, op.OutputListLength("biases")).Select(_ => op.outputs[_idx++]).ToArray();
+ return (weights, biases);
+ }
+
+ ///
+ /// A RNN backed by cuDNN.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CudnnRNNV2'.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Returns a tuple with multiple values, as follows:
+ /// output :
+ /// output_h :
+ /// output_c :
+ /// reserve_space :
+ /// host_reserved :
+ /// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
+ ///
+ ///
+ /// Computes the RNN from the input and initial states, with respect to the params
+ /// buffer. Produces one extra output "host_reserved" than CudnnRNN.
+ ///
+ /// rnn_mode: Indicates the type of the RNN model.
+ /// input_mode: Indicates whether there is a linear projection between the input and
+ /// the actual computation before the first layer. 'skip_input' is only allowed
+ /// when input_size == num_units; 'auto_select' implies 'skip_input' when
+ /// input_size == num_units; otherwise, it implies 'linear_input'.
+ /// direction: Indicates whether a bidirectional model will be used. Should be
+ /// "unidirectional" or "bidirectional".
+ /// dropout: Dropout probability. When set to 0., dropout is disabled.
+ /// seed: The 1st part of a seed to initialize dropout.
+ /// seed2: The 2nd part of a seed to initialize dropout.
+ /// input: A 3-D tensor with the shape of [seq_length, batch_size, input_size].
+ /// input_h: A 3-D tensor with the shape of [num_layer * dir, batch_size,
+ /// num_units].
+ /// input_c: For LSTM, a 3-D tensor with the shape of
+ /// [num_layer * dir, batch, num_units]. For other models, it is ignored.
+ /// params: A 1-D tensor that contains the weights and biases in an opaque layout.
+ /// The size must be created through CudnnRNNParamsSize, and initialized
+ /// separately. Note that they might not be compatible across different
+ /// generations. So it is a good idea to save and restore
+ /// output: A 3-D tensor with the shape of [seq_length, batch_size,
+ /// dir * num_units].
+ /// output_h: The same shape has input_h.
+ /// output_c: The same shape as input_c for LSTM. An empty tensor for other models.
+ /// is_training: Indicates whether this operation is used for inferenece or
+ /// training.
+ /// reserve_space: An opaque tensor that can be used in backprop calculation. It
+ /// is only produced if is_training is true.
+ /// host_reserved: An opaque tensor that can be used in backprop calculation. It is
+ /// only produced if is_training is true. It is output on host memory rather than
+ /// device memory.
+ ///
+ public static (Tensor output, Tensor output_h, Tensor output_c, Tensor reserve_space, Tensor host_reserved) cudnn_r_n_n_v2 (Tensor input, Tensor input_h, Tensor input_c, Tensor parameters, string rnn_mode = null, string input_mode = null, string direction = null, float? dropout = null, int? seed = null, int? seed2 = null, bool? is_training = null, string name = "CudnnRNNV2")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["input_h"] = input_h;
+ dict["input_c"] = input_c;
+ dict["params"] = parameters;
+ if (rnn_mode != null)
+ dict["rnn_mode"] = rnn_mode;
+ if (input_mode != null)
+ dict["input_mode"] = input_mode;
+ if (direction != null)
+ dict["direction"] = direction;
+ if (dropout.HasValue)
+ dict["dropout"] = dropout.Value;
+ if (seed.HasValue)
+ dict["seed"] = seed.Value;
+ if (seed2.HasValue)
+ dict["seed2"] = seed2.Value;
+ if (is_training.HasValue)
+ dict["is_training"] = is_training.Value;
+ var op = _op_def_lib._apply_op_helper("CudnnRNNV2", name: name, keywords: dict);
+ int _idx = 0;
+ var output = op.outputs[_idx++];
+ var output_h = op.outputs[_idx++];
+ var output_c = op.outputs[_idx++];
+ var reserve_space = op.outputs[_idx++];
+ var host_reserved = op.outputs[_idx++];
+ return (output, output_h, output_c, reserve_space, host_reserved);
+ }
+
+ ///
+ /// Compute the cumulative product of the tensor x along axis.
+ ///
+ ///
+ /// A Tensor. Must be one of the following types: float32, float64,
+ /// int64, int32, uint8, uint16, int16, int8, complex64,
+ /// complex128, qint8, quint8, qint32, half.
+ ///
+ ///
+ /// A Tensor of type int32 (default: 0). Must be in the range
+ /// [-rank(x), rank(x)).
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Cumprod'.
+ ///
+ ///
+ /// If True, perform exclusive cumprod.
+ ///
+ ///
+ /// A bool (default: False).
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// By default, this op performs an inclusive cumprod, which means that the first
+ /// element of the input is identical to the first element of the output:
+ ///
+ ///
+ /// tf.cumprod([a, b, c]) # => [a, a * b, a * b * c]
+ ///
+ ///
+ /// By setting the exclusive kwarg to True, an exclusive cumprod is
+ /// performed instead:
+ ///
+ ///
+ /// tf.cumprod([a, b, c], exclusive=True) # => [1, a, a * b]
+ ///
+ ///
+ /// By setting the reverse kwarg to True, the cumprod is performed in the
+ /// opposite direction:
+ ///
+ ///
+ /// tf.cumprod([a, b, c], reverse=True) # => [a * b * c, b * c, c]
+ ///
+ ///
+ /// This is more efficient than using separate tf.reverse ops.
+ ///
+ /// The reverse and exclusive kwargs can also be combined:
+ ///
+ ///
+ /// tf.cumprod([a, b, c], exclusive=True, reverse=True) # => [b * c, c, 1]
+ ///
+ ///
+ public static Tensor cumprod (Tensor x, Tensor axis, bool? exclusive = null, bool? reverse = null, string name = "Cumprod")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ dict["axis"] = axis;
+ if (exclusive.HasValue)
+ dict["exclusive"] = exclusive.Value;
+ if (reverse.HasValue)
+ dict["reverse"] = reverse.Value;
+ var op = _op_def_lib._apply_op_helper("Cumprod", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Compute the cumulative sum of the tensor x along axis.
+ ///
+ ///
+ /// A Tensor. Must be one of the following types: float32, float64,
+ /// int64, int32, uint8, uint16, int16, int8, complex64,
+ /// complex128, qint8, quint8, qint32, half.
+ ///
+ ///
+ /// A Tensor of type int32 (default: 0). Must be in the range
+ /// [-rank(x), rank(x)).
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Cumsum'.
+ ///
+ ///
+ /// If True, perform exclusive cumsum.
+ ///
+ ///
+ /// A bool (default: False).
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// By default, this op performs an inclusive cumsum, which means that the first
+ /// element of the input is identical to the first element of the output:
+ ///
+ ///
+ /// tf.cumsum([a, b, c]) # => [a, a + b, a + b + c]
+ ///
+ ///
+ /// By setting the exclusive kwarg to True, an exclusive cumsum is
+ /// performed instead:
+ ///
+ ///
+ /// tf.cumsum([a, b, c], exclusive=True) # => [0, a, a + b]
+ ///
+ ///
+ /// By setting the reverse kwarg to True, the cumsum is performed in the
+ /// opposite direction:
+ ///
+ ///
+ /// tf.cumsum([a, b, c], reverse=True) # => [a + b + c, b + c, c]
+ ///
+ ///
+ /// This is more efficient than using separate tf.reverse ops.
+ ///
+ /// The reverse and exclusive kwargs can also be combined:
+ ///
+ ///
+ /// tf.cumsum([a, b, c], exclusive=True, reverse=True) # => [b + c, c, 0]
+ ///
+ ///
+ public static Tensor cumsum (Tensor x, Tensor axis, bool? exclusive = null, bool? reverse = null, string name = "Cumsum")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ dict["axis"] = axis;
+ if (exclusive.HasValue)
+ dict["exclusive"] = exclusive.Value;
+ if (reverse.HasValue)
+ dict["reverse"] = reverse.Value;
+ var op = _op_def_lib._apply_op_helper("Cumsum", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Returns the dimension index in the destination data format given the one in
+ ///
+ ///
+ /// A Tensor with each element as a dimension index in source data format.
+ /// Must be in the range [-4, 4).
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DataFormatDimMap'.
+ ///
+ ///
+ /// source data format.
+ ///
+ ///
+ /// destination data format.
+ ///
+ ///
+ /// A Tensor with each element as a dimension index in destination data format.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// the source data format.
+ ///
+ public static Tensor data_format_dim_map (Tensor x, string src_format = null, string dst_format = null, string name = "DataFormatDimMap")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ if (src_format != null)
+ dict["src_format"] = src_format;
+ if (dst_format != null)
+ dict["dst_format"] = dst_format;
+ var op = _op_def_lib._apply_op_helper("DataFormatDimMap", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Returns the permuted vector/tensor in the destination data format given the
+ ///
+ ///
+ /// Vector of size 4 or Tensor of shape (4, 2) in source data format.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DataFormatVecPermute'.
+ ///
+ ///
+ /// source data format.
+ ///
+ ///
+ /// destination data format.
+ ///
+ ///
+ /// Vector of size 4 or Tensor of shape (4, 2) in destination data format.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// one in the source data format.
+ ///
+ public static Tensor data_format_vec_permute (Tensor x, string src_format = null, string dst_format = null, string name = "DataFormatVecPermute")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ if (src_format != null)
+ dict["src_format"] = src_format;
+ if (dst_format != null)
+ dict["dst_format"] = dst_format;
+ var op = _op_def_lib._apply_op_helper("DataFormatVecPermute", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Returns a serialized GraphDef representing input_dataset.
+ ///
+ ///
+ /// A variant tensor representing the dataset to return the graph representation for.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DatasetToGraph'.
+ ///
+ ///
+ /// The graph representation of the dataset (as serialized GraphDef).
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Returns a graph representation for input_dataset.
+ ///
+ public static Tensor dataset_to_graph (Tensor input_dataset, string name = "DatasetToGraph")
+ {
+ var dict = new Dictionary();
+ dict["input_dataset"] = input_dataset;
+ var op = _op_def_lib._apply_op_helper("DatasetToGraph", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Outputs the single element from the given dataset.
+ ///
+ ///
+ /// A handle to a dataset that contains a single element.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DatasetToSingleElement'.
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// The components of the single element of input.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor[] dataset_to_single_element (Tensor dataset, TF_DataType[] output_types, TensorShape[] output_shapes, string name = "DatasetToSingleElement")
+ {
+ var dict = new Dictionary();
+ dict["dataset"] = dataset;
+ dict["output_types"] = output_types;
+ dict["output_shapes"] = output_shapes;
+ var op = _op_def_lib._apply_op_helper("DatasetToSingleElement", name: name, keywords: dict);
+ int _idx = 0;
+ var components = Enumerable.Range(0, op.OutputListLength("components")).Select(_ => op.outputs[_idx++]).ToArray();
+ return (components);
+ }
+
+ ///
+ /// Writes the given dataset to the given file using the TFRecord format.
+ ///
+ ///
+ /// A variant tensor representing the dataset to write.
+ ///
+ ///
+ /// A scalar string tensor representing the filename to use.
+ ///
+ ///
+ /// A scalar string tensor containing either (i) the empty string (no
+ /// compression), (ii) "ZLIB", or (iii) "GZIP".
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DatasetToTFRecord'.
+ ///
+ ///
+ /// Returns the description of the operation
+ ///
+ public static Operation dataset_to_t_f_record (Tensor input_dataset, Tensor filename, Tensor compression_type, string name = "DatasetToTFRecord")
+ {
+ var dict = new Dictionary();
+ dict["input_dataset"] = input_dataset;
+ dict["filename"] = filename;
+ dict["compression_type"] = compression_type;
+ var op = _op_def_lib._apply_op_helper("DatasetToTFRecord", name: name, keywords: dict);
+ return op;
+ }
+
+ ///
+ /// Identity op for gradient debugging.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DebugGradientIdentity'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// This op is hidden from public in Python. It is used by TensorFlow Debugger to
+ /// register gradient tensors for gradient debugging.
+ /// This op operates on non-reference-type tensors.
+ ///
+ public static Tensor debug_gradient_identity (Tensor input, string name = "DebugGradientIdentity")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ var op = _op_def_lib._apply_op_helper("DebugGradientIdentity", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Identity op for gradient debugging.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DebugGradientRefIdentity'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// This op is hidden from public in Python. It is used by TensorFlow Debugger to
+ /// register gradient tensors for gradient debugging.
+ /// This op operates on reference-type tensors.
+ ///
+ public static Tensor debug_gradient_ref_identity (Tensor input, string name = "DebugGradientRefIdentity")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ var op = _op_def_lib._apply_op_helper("DebugGradientRefIdentity", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Debug Identity Op.
+ ///
+ ///
+ /// Input tensor, non-Reference type.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DebugIdentity'.
+ ///
+ ///
+ ///
+ ///
+ /// Name of the input tensor.
+ ///
+ ///
+ /// List of URLs to debug targets, e.g.,
+ /// file:///foo/tfdbg_dump, grpc:://localhost:11011
+ ///
+ ///
+ /// Whether this op will be gated. If any of the debug_urls of this
+ /// debug node is of the grpc:// scheme, when the value of this attribute is set
+ /// to True, the data will not actually be sent via the grpc stream unless this
+ /// debug op has been enabled at the debug_url. If all of the debug_urls of this
+ /// debug node are of the grpc:// scheme and the debug op is enabled at none of
+ /// them, the output will be an empty Tensor.
+ ///
+ ///
+ /// Output tensor that equals the input tensor.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Provides an identity mapping of the non-Ref type input tensor for debugging.
+ ///
+ public static Tensor debug_identity (Tensor input, string device_name = null, string tensor_name = null, string[] debug_urls = null, bool? gated_grpc = null, string name = "DebugIdentity")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ if (device_name != null)
+ dict["device_name"] = device_name;
+ if (tensor_name != null)
+ dict["tensor_name"] = tensor_name;
+ if (debug_urls != null)
+ dict["debug_urls"] = debug_urls;
+ if (gated_grpc.HasValue)
+ dict["gated_grpc"] = gated_grpc.Value;
+ var op = _op_def_lib._apply_op_helper("DebugIdentity", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Debug NaN Value Counter Op
+ ///
+ ///
+ /// Input tensor, non-Reference type.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DebugNanCount'.
+ ///
+ ///
+ ///
+ ///
+ /// Name of the input tensor.
+ ///
+ ///
+ /// List of URLs to debug targets, e.g.,
+ /// file:///foo/tfdbg_dump, grpc:://localhost:11011.
+ ///
+ ///
+ /// Whether this op will be gated. If any of the debug_urls of this
+ /// debug node is of the grpc:// scheme, when the value of this attribute is set
+ /// to True, the data will not actually be sent via the grpc stream unless this
+ /// debug op has been enabled at the debug_url. If all of the debug_urls of this
+ /// debug node are of the grpc:// scheme and the debug op is enabled at none of
+ /// them, the output will be an empty Tensor.
+ ///
+ ///
+ /// An integer output tensor that is the number of NaNs in the input.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Counts number of NaNs in the input tensor, for debugging.
+ ///
+ public static Tensor debug_nan_count (Tensor input, string device_name = null, string tensor_name = null, string[] debug_urls = null, bool? gated_grpc = null, string name = "DebugNanCount")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ if (device_name != null)
+ dict["device_name"] = device_name;
+ if (tensor_name != null)
+ dict["tensor_name"] = tensor_name;
+ if (debug_urls != null)
+ dict["debug_urls"] = debug_urls;
+ if (gated_grpc.HasValue)
+ dict["gated_grpc"] = gated_grpc.Value;
+ var op = _op_def_lib._apply_op_helper("DebugNanCount", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Debug Numeric Summary Op.
+ ///
+ ///
+ /// Input tensor, non-Reference type, float or double.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DebugNumericSummary'.
+ ///
+ ///
+ ///
+ ///
+ /// Name of the input tensor.
+ ///
+ ///
+ /// List of URLs to debug targets, e.g.,
+ /// file:///foo/tfdbg_dump, grpc:://localhost:11011
+ ///
+ ///
+ /// (float) The lower bound <= which values will be included in the
+ /// generalized -inf count. Default: -inf.
+ ///
+ ///
+ /// (float) The upper bound >= which values will be included in the
+ /// generalized +inf count. Default: +inf.
+ ///
+ ///
+ /// (bool) Do not send data to the debug URLs unless at least one
+ /// of elements [2], [3] and [7] (i.e., the nan count and the generalized -inf and
+ /// inf counts) is non-zero.
+ ///
+ ///
+ /// Whether this op will be gated. If any of the debug_urls of this
+ /// debug node is of the grpc:// scheme, when the value of this attribute is set
+ /// to True, the data will not actually be sent via the grpc stream unless this
+ /// debug op has been enabled at the debug_url. If all of the debug_urls of this
+ /// debug node are of the grpc:// scheme and the debug op is enabled at none of
+ /// them, the output will be an empty Tensor.
+ ///
+ ///
+ /// A double tensor of shape [14 + nDimensions], where nDimensions is the
+ /// the number of dimensions of the tensor's shape. The elements of output are:
+ /// [0]: is initialized (1.0) or not (0.0).
+ /// [1]: total number of elements
+ /// [2]: NaN element count
+ /// [3]: generalized -inf count: elements <= lower_bound. lower_bound is -inf by
+ /// default.
+ /// [4]: negative element count (excluding -inf), if lower_bound is the default
+ /// -inf. Otherwise, this is the count of elements > lower_bound and < 0.
+ /// [5]: zero element count
+ /// [6]: positive element count (excluding +inf), if upper_bound is the default
+ /// -inf. Otherwise, this is the count of elements < upper_bound and > 0.
+ /// [7]: generalized +inf count, elements >= upper_bound. upper_bound is +inf by
+ /// default.
+ /// Output elements [1:8] are all zero, if the tensor is uninitialized.
+ /// [8]: minimum of all non-inf and non-NaN elements.
+ /// If uninitialized or no such element exists: +inf.
+ /// [9]: maximum of all non-inf and non-NaN elements.
+ /// If uninitialized or no such element exists: -inf.
+ /// [10]: mean of all non-inf and non-NaN elements.
+ /// If uninitialized or no such element exists: NaN.
+ /// [11]: variance of all non-inf and non-NaN elements.
+ /// If uninitialized or no such element exists: NaN.
+ /// [12]: Data type of the tensor encoded as an enum integer. See the DataType
+ /// proto for more details.
+ /// [13]: Number of dimensions of the tensor (ndims).
+ /// [14+]: Sizes of the dimensions.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Provide a basic summary of numeric value types, range and distribution.
+ ///
+ public static Tensor debug_numeric_summary (Tensor input, string device_name = null, string tensor_name = null, string[] debug_urls = null, float? lower_bound = null, float? upper_bound = null, bool? mute_if_healthy = null, bool? gated_grpc = null, string name = "DebugNumericSummary")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ if (device_name != null)
+ dict["device_name"] = device_name;
+ if (tensor_name != null)
+ dict["tensor_name"] = tensor_name;
+ if (debug_urls != null)
+ dict["debug_urls"] = debug_urls;
+ if (lower_bound.HasValue)
+ dict["lower_bound"] = lower_bound.Value;
+ if (upper_bound.HasValue)
+ dict["upper_bound"] = upper_bound.Value;
+ if (mute_if_healthy.HasValue)
+ dict["mute_if_healthy"] = mute_if_healthy.Value;
+ if (gated_grpc.HasValue)
+ dict["gated_grpc"] = gated_grpc.Value;
+ var op = _op_def_lib._apply_op_helper("DebugNumericSummary", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Decode and Crop a JPEG-encoded image to a uint8 tensor.
+ ///
+ ///
+ /// 0-D. The JPEG-encoded image.
+ ///
+ ///
+ /// 1-D. The crop window: [crop_y, crop_x, crop_height, crop_width].
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DecodeAndCropJpeg'.
+ ///
+ ///
+ /// Number of color channels for the decoded image.
+ ///
+ ///
+ /// Downscaling ratio.
+ ///
+ ///
+ /// If true use a slower but nicer upscaling of the
+ /// chroma planes (yuv420/422 only).
+ ///
+ ///
+ /// If true try to recover an image from truncated input.
+ ///
+ ///
+ /// The minimum required fraction of lines before a truncated
+ /// input is accepted.
+ ///
+ ///
+ /// string specifying a hint about the algorithm used for
+ /// decompression. Defaults to "" which maps to a system-specific
+ /// default. Currently valid values are ["INTEGER_FAST",
+ /// "INTEGER_ACCURATE"]. The hint may be ignored (e.g., the internal
+ /// jpeg library changes to a version that does not have that specific
+ /// option.)
+ ///
+ ///
+ /// 3-D with shape [height, width, channels]..
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// The attr channels indicates the desired number of color channels for the
+ /// decoded image.
+ ///
+ /// Accepted values are:
+ ///
+ /// * 0: Use the number of channels in the JPEG-encoded image.
+ /// * 1: output a grayscale image.
+ /// * 3: output an RGB image.
+ ///
+ /// If needed, the JPEG-encoded image is transformed to match the requested number
+ /// of color channels.
+ ///
+ /// The attr ratio allows downscaling the image by an integer factor during
+ /// decoding. Allowed values are: 1, 2, 4, and 8. This is much faster than
+ /// downscaling the image later.
+ ///
+ ///
+ /// It is equivalent to a combination of decode and crop, but much faster by only
+ /// decoding partial jpeg image.
+ ///
+ public static Tensor decode_and_crop_jpeg (Tensor contents, Tensor crop_window, int? channels = null, int? ratio = null, bool? fancy_upscaling = null, bool? try_recover_truncated = null, float? acceptable_fraction = null, string dct_method = null, string name = "DecodeAndCropJpeg")
+ {
+ var dict = new Dictionary();
+ dict["contents"] = contents;
+ dict["crop_window"] = crop_window;
+ if (channels.HasValue)
+ dict["channels"] = channels.Value;
+ if (ratio.HasValue)
+ dict["ratio"] = ratio.Value;
+ if (fancy_upscaling.HasValue)
+ dict["fancy_upscaling"] = fancy_upscaling.Value;
+ if (try_recover_truncated.HasValue)
+ dict["try_recover_truncated"] = try_recover_truncated.Value;
+ if (acceptable_fraction.HasValue)
+ dict["acceptable_fraction"] = acceptable_fraction.Value;
+ if (dct_method != null)
+ dict["dct_method"] = dct_method;
+ var op = _op_def_lib._apply_op_helper("DecodeAndCropJpeg", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Decode web-safe base64-encoded strings.
+ ///
+ ///
+ /// Base64 strings to decode.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DecodeBase64'.
+ ///
+ ///
+ /// Decoded strings.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Input may or may not have padding at the end. See EncodeBase64 for padding.
+ /// Web-safe means that input must use - and _ instead of + and /.
+ ///
+ public static Tensor decode_base64 (Tensor input, string name = "DecodeBase64")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ var op = _op_def_lib._apply_op_helper("DecodeBase64", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Decode the first frame of a BMP-encoded image to a uint8 tensor.
+ ///
+ ///
+ /// 0-D. The BMP-encoded image.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DecodeBmp'.
+ ///
+ ///
+ ///
+ ///
+ /// 3-D with shape [height, width, channels]. RGB order
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// The attr channels indicates the desired number of color channels for the
+ /// decoded image.
+ ///
+ /// Accepted values are:
+ ///
+ /// * 0: Use the number of channels in the BMP-encoded image.
+ /// * 3: output an RGB image.
+ /// * 4: output an RGBA image.
+ ///
+ public static Tensor decode_bmp (Tensor contents, int? channels = null, string name = "DecodeBmp")
+ {
+ var dict = new Dictionary();
+ dict["contents"] = contents;
+ if (channels.HasValue)
+ dict["channels"] = channels.Value;
+ var op = _op_def_lib._apply_op_helper("DecodeBmp", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Convert CSV records to tensors. Each column maps to one tensor.
+ ///
+ ///
+ /// Each string is a record/row in the csv and all records should have
+ /// the same format.
+ ///
+ ///
+ /// One tensor per column of the input record, with either a
+ /// scalar default value for that column or an empty vector if the column is
+ /// required.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DecodeCSV'.
+ ///
+ ///
+ /// char delimiter to separate fields in a record.
+ ///
+ ///
+ /// If false, treats double quotation marks as regular
+ /// characters inside of the string fields (ignoring RFC 4180, Section 2,
+ /// Bullet 5).
+ ///
+ ///
+ /// Additional string to recognize as NA/NaN.
+ ///
+ ///
+ ///
+ ///
+ /// Each tensor will have the same shape as records.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// RFC 4180 format is expected for the CSV records.
+ /// (https://tools.ietf.org/html/rfc4180)
+ /// Note that we allow leading and trailing spaces with int or float field.
+ ///
+ public static Tensor[] decode_c_s_v (Tensor records, Tensor[] record_defaults, string field_delim = null, bool? use_quote_delim = null, string na_value = null, int[] select_cols = null, string name = "DecodeCSV")
+ {
+ var dict = new Dictionary();
+ dict["records"] = records;
+ dict["record_defaults"] = record_defaults;
+ if (field_delim != null)
+ dict["field_delim"] = field_delim;
+ if (use_quote_delim.HasValue)
+ dict["use_quote_delim"] = use_quote_delim.Value;
+ if (na_value != null)
+ dict["na_value"] = na_value;
+ if (select_cols != null)
+ dict["select_cols"] = select_cols;
+ var op = _op_def_lib._apply_op_helper("DecodeCSV", name: name, keywords: dict);
+ int _idx = 0;
+ var output = Enumerable.Range(0, op.OutputListLength("output")).Select(_ => op.outputs[_idx++]).ToArray();
+ return (output);
+ }
+
+ ///
+ /// Decompress strings.
+ ///
+ ///
+ /// A Tensor of string which is compressed.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DecodeCompressed'.
+ ///
+ ///
+ /// A scalar containing either (i) the empty string (no
+ /// compression), (ii) "ZLIB", or (iii) "GZIP".
+ ///
+ ///
+ /// A Tensor with the same shape as input bytes, uncompressed
+ /// from bytes.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// This op decompresses each element of the bytes input Tensor, which
+ /// is assumed to be compressed using the given compression_type.
+ ///
+ /// The output is a string Tensor of the same shape as bytes,
+ /// each element containing the decompressed data from the corresponding
+ /// element in bytes.
+ ///
+ public static Tensor decode_compressed (Tensor bytes, string compression_type = null, string name = "DecodeCompressed")
+ {
+ var dict = new Dictionary();
+ dict["bytes"] = bytes;
+ if (compression_type != null)
+ dict["compression_type"] = compression_type;
+ var op = _op_def_lib._apply_op_helper("DecodeCompressed", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Decode the first frame of a GIF-encoded image to a uint8 tensor.
+ ///
+ ///
+ /// 0-D. The GIF-encoded image.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DecodeGif'.
+ ///
+ ///
+ /// 4-D with shape [num_frames, height, width, 3]. RGB order
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// GIF with frame or transparency compression are not supported
+ /// convert animated GIF from compressed to uncompressed by:
+ ///
+ /// convert $src.gif -coalesce $dst.gif
+ ///
+ /// This op also supports decoding JPEGs and PNGs, though it is cleaner to use
+ /// tf.image.decode_image.
+ ///
+ public static Tensor decode_gif (Tensor contents, string name = "DecodeGif")
+ {
+ var dict = new Dictionary();
+ dict["contents"] = contents;
+ var op = _op_def_lib._apply_op_helper("DecodeGif", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Convert JSON-encoded Example records to binary protocol buffer strings.
+ ///
+ ///
+ /// Each string is a JSON object serialized according to the JSON
+ /// mapping of the Example proto.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DecodeJSONExample'.
+ ///
+ ///
+ /// Each string is a binary Example protocol buffer corresponding
+ /// to the respective element of json_examples.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// This op translates a tensor containing Example records, encoded using
+ /// the [standard JSON
+ /// mapping](https://developers.google.com/protocol-buffers/docs/proto3#json),
+ /// into a tensor containing the same records encoded as binary protocol
+ /// buffers. The resulting tensor can then be fed to any of the other
+ /// Example-parsing ops.
+ ///
+ public static Tensor decode_j_s_o_n_example (Tensor json_examples, string name = "DecodeJSONExample")
+ {
+ var dict = new Dictionary();
+ dict["json_examples"] = json_examples;
+ var op = _op_def_lib._apply_op_helper("DecodeJSONExample", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Decode a JPEG-encoded image to a uint8 tensor.
+ ///
+ ///
+ /// 0-D. The JPEG-encoded image.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DecodeJpeg'.
+ ///
+ ///
+ /// Number of color channels for the decoded image.
+ ///
+ ///
+ /// Downscaling ratio.
+ ///
+ ///
+ /// If true use a slower but nicer upscaling of the
+ /// chroma planes (yuv420/422 only).
+ ///
+ ///
+ /// If true try to recover an image from truncated input.
+ ///
+ ///
+ /// The minimum required fraction of lines before a truncated
+ /// input is accepted.
+ ///
+ ///
+ /// string specifying a hint about the algorithm used for
+ /// decompression. Defaults to "" which maps to a system-specific
+ /// default. Currently valid values are ["INTEGER_FAST",
+ /// "INTEGER_ACCURATE"]. The hint may be ignored (e.g., the internal
+ /// jpeg library changes to a version that does not have that specific
+ /// option.)
+ ///
+ ///
+ /// 3-D with shape [height, width, channels]..
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// The attr channels indicates the desired number of color channels for the
+ /// decoded image.
+ ///
+ /// Accepted values are:
+ ///
+ /// * 0: Use the number of channels in the JPEG-encoded image.
+ /// * 1: output a grayscale image.
+ /// * 3: output an RGB image.
+ ///
+ /// If needed, the JPEG-encoded image is transformed to match the requested number
+ /// of color channels.
+ ///
+ /// The attr ratio allows downscaling the image by an integer factor during
+ /// decoding. Allowed values are: 1, 2, 4, and 8. This is much faster than
+ /// downscaling the image later.
+ ///
+ ///
+ /// This op also supports decoding PNGs and non-animated GIFs since the interface is
+ /// the same, though it is cleaner to use tf.image.decode_image.
+ ///
+ public static Tensor decode_jpeg (Tensor contents, int? channels = null, int? ratio = null, bool? fancy_upscaling = null, bool? try_recover_truncated = null, float? acceptable_fraction = null, string dct_method = null, string name = "DecodeJpeg")
+ {
+ var dict = new Dictionary();
+ dict["contents"] = contents;
+ if (channels.HasValue)
+ dict["channels"] = channels.Value;
+ if (ratio.HasValue)
+ dict["ratio"] = ratio.Value;
+ if (fancy_upscaling.HasValue)
+ dict["fancy_upscaling"] = fancy_upscaling.Value;
+ if (try_recover_truncated.HasValue)
+ dict["try_recover_truncated"] = try_recover_truncated.Value;
+ if (acceptable_fraction.HasValue)
+ dict["acceptable_fraction"] = acceptable_fraction.Value;
+ if (dct_method != null)
+ dict["dct_method"] = dct_method;
+ var op = _op_def_lib._apply_op_helper("DecodeJpeg", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Decode a PNG-encoded image to a uint8 or uint16 tensor.
+ ///
+ ///
+ /// 0-D. The PNG-encoded image.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DecodePng'.
+ ///
+ ///
+ /// Number of color channels for the decoded image.
+ ///
+ ///
+ ///
+ ///
+ /// 3-D with shape [height, width, channels].
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// The attr channels indicates the desired number of color channels for the
+ /// decoded image.
+ ///
+ /// Accepted values are:
+ ///
+ /// * 0: Use the number of channels in the PNG-encoded image.
+ /// * 1: output a grayscale image.
+ /// * 3: output an RGB image.
+ /// * 4: output an RGBA image.
+ ///
+ /// If needed, the PNG-encoded image is transformed to match the requested number
+ /// of color channels.
+ ///
+ /// This op also supports decoding JPEGs and non-animated GIFs since the interface
+ /// is the same, though it is cleaner to use tf.image.decode_image.
+ ///
+ public static Tensor decode_png (Tensor contents, int? channels = null, TF_DataType? dtype = null, string name = "DecodePng")
+ {
+ var dict = new Dictionary();
+ dict["contents"] = contents;
+ if (channels.HasValue)
+ dict["channels"] = channels.Value;
+ if (dtype.HasValue)
+ dict["dtype"] = dtype.Value;
+ var op = _op_def_lib._apply_op_helper("DecodePng", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// The op extracts fields from a serialized protocol buffers message into tensors.
+ ///
+ ///
+ /// Tensor of serialized protos with shape batch_shape.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DecodeProtoV2'.
+ ///
+ ///
+ /// Optional argument
+ /// Name of the proto message type to decode.
+ ///
+ ///
+ /// Optional argument
+ /// List of strings containing proto field names.
+ ///
+ ///
+ /// Optional argument
+ /// List of TF types to use for the respective field in field_names.
+ ///
+ ///
+ /// Either the special value local:// or a path to a file containing
+ /// a serialized FileDescriptorSet.
+ ///
+ ///
+ /// Either binary or text.
+ ///
+ ///
+ /// Whether to sanitize the result or not.
+ ///
+ ///
+ /// Returns a tuple with multiple values, as follows:
+ /// sizes : Tensor of int32 with shape [batch_shape, len(field_names)].
+ /// Each entry is the number of values found for the corresponding field.
+ /// Optional fields may have 0 or 1 values.
+ /// values : List of tensors containing values for the corresponding field.
+ /// values[i] has datatype output_types[i]
+ /// and shape [batch_shape, max(sizes[...,i])].
+ /// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
+ ///
+ ///
+ /// The decode_proto op extracts fields from a serialized protocol buffers
+ /// message into tensors. The fields in field_names are decoded and converted
+ /// to the corresponding output_types if possible.
+ ///
+ /// A message_type name must be provided to give context for the field
+ /// names. The actual message descriptor can be looked up either in the
+ /// linked-in descriptor pool or a filename provided by the caller using
+ /// the descriptor_source attribute.
+ ///
+ /// Each output tensor is a dense tensor. This means that it is padded to
+ /// hold the largest number of repeated elements seen in the input
+ /// minibatch. (The shape is also padded by one to prevent zero-sized
+ /// dimensions). The actual repeat counts for each example in the
+ /// minibatch can be found in the sizes output. In many cases the output
+ /// of decode_proto is fed immediately into tf.squeeze if missing values
+ /// are not a concern. When using tf.squeeze, always pass the squeeze
+ /// dimension explicitly to avoid surprises.
+ ///
+ /// For the most part, the mapping between Proto field types and
+ /// TensorFlow dtypes is straightforward. However, there are a few
+ /// special cases:
+ ///
+ /// - A proto field that contains a submessage or group can only be converted
+ /// to DT_STRING (the serialized submessage). This is to reduce the
+ /// complexity of the API. The resulting string can be used as input
+ /// to another instance of the decode_proto op.
+ ///
+ /// - TensorFlow lacks support for unsigned integers. The ops represent uint64
+ /// types as a DT_INT64 with the same twos-complement bit pattern
+ /// (the obvious way). Unsigned int32 values can be represented exactly by
+ /// specifying type DT_INT64, or using twos-complement if the caller
+ /// specifies DT_INT32 in the output_types attribute.
+ ///
+ /// The descriptor_source attribute selects a source of protocol
+ /// descriptors to consult when looking up message_type. This may be a
+ /// filename containing a serialized FileDescriptorSet message,
+ /// or the special value local://, in which case only descriptors linked
+ /// into the code will be searched; the filename can be on any filesystem
+ /// accessible to TensorFlow.
+ ///
+ /// You can build a descriptor_source file using the --descriptor_set_out
+ /// and --include_imports options to the protocol compiler protoc.
+ ///
+ /// The local:// database only covers descriptors linked into the
+ /// code via C++ libraries, not Python imports. You can link in a proto descriptor
+ /// by creating a cc_library target with alwayslink=1.
+ ///
+ /// Both binary and text proto serializations are supported, and can be
+ /// chosen using the format attribute.
+ ///
+ public static (Tensor sizes, Tensor[] values) decode_proto_v2 (Tensor bytes, string message_type, string[] field_names, TF_DataType[] output_types, string descriptor_source = null, string message_format = null, bool? sanitize = null, string name = "DecodeProtoV2")
+ {
+ var dict = new Dictionary();
+ dict["bytes"] = bytes;
+ dict["message_type"] = message_type;
+ dict["field_names"] = field_names;
+ dict["output_types"] = output_types;
+ if (descriptor_source != null)
+ dict["descriptor_source"] = descriptor_source;
+ if (message_format != null)
+ dict["message_format"] = message_format;
+ if (sanitize.HasValue)
+ dict["sanitize"] = sanitize.Value;
+ var op = _op_def_lib._apply_op_helper("DecodeProtoV2", name: name, keywords: dict);
+ int _idx = 0;
+ var sizes = op.outputs[_idx++];
+ var values = Enumerable.Range(0, op.OutputListLength("values")).Select(_ => op.outputs[_idx++]).ToArray();
+ return (sizes, values);
+ }
+
+ ///
+ /// Reinterpret the bytes of a string as a vector of numbers.
+ ///
+ ///
+ /// All the elements must have the same length.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DecodeRaw'.
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// Whether the input bytes are in little-endian order.
+ /// Ignored for out_type values that are stored in a single byte like
+ /// uint8.
+ ///
+ ///
+ /// A Tensor with one more dimension than the input bytes. The
+ /// added dimension will have size equal to the length of the elements
+ /// of bytes divided by the number of bytes to represent out_type.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor decode_raw (Tensor bytes, TF_DataType out_type, bool? little_endian = null, string name = "DecodeRaw")
+ {
+ var dict = new Dictionary();
+ dict["bytes"] = bytes;
+ dict["out_type"] = out_type;
+ if (little_endian.HasValue)
+ dict["little_endian"] = little_endian.Value;
+ var op = _op_def_lib._apply_op_helper("DecodeRaw", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Decode a 16-bit PCM WAV file to a float tensor.
+ ///
+ ///
+ /// The WAV-encoded audio, usually from a file.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DecodeWav'.
+ ///
+ ///
+ /// Number of sample channels wanted.
+ ///
+ ///
+ /// Length of audio requested.
+ ///
+ ///
+ /// Returns a tuple with multiple values, as follows:
+ /// audio : 2-D with shape [length, channels].
+ /// sample_rate : Scalar holding the sample rate found in the WAV header.
+ /// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
+ ///
+ ///
+ /// The -32768 to 32767 signed 16-bit values will be scaled to -1.0 to 1.0 in float.
+ ///
+ /// When desired_channels is set, if the input contains fewer channels than this
+ /// then the last channel will be duplicated to give the requested number, else if
+ /// the input has more channels than requested then the additional channels will be
+ /// ignored.
+ ///
+ /// If desired_samples is set, then the audio will be cropped or padded with zeroes
+ /// to the requested length.
+ ///
+ /// The first output contains a Tensor with the content of the audio samples. The
+ /// lowest dimension will be the number of channels, and the second will be the
+ /// number of samples. For example, a ten-sample-long stereo WAV file should give an
+ /// output shape of [10, 2].
+ ///
+ public static (Tensor audio, Tensor sample_rate) decode_wav (Tensor contents, int? desired_channels = null, int? desired_samples = null, string name = "DecodeWav")
+ {
+ var dict = new Dictionary();
+ dict["contents"] = contents;
+ if (desired_channels.HasValue)
+ dict["desired_channels"] = desired_channels.Value;
+ if (desired_samples.HasValue)
+ dict["desired_samples"] = desired_samples.Value;
+ var op = _op_def_lib._apply_op_helper("DecodeWav", name: name, keywords: dict);
+ int _idx = 0;
+ var audio = op.outputs[_idx++];
+ var sample_rate = op.outputs[_idx++];
+ return (audio, sample_rate);
+ }
+
+ ///
+ /// Makes a copy of x.
+ ///
+ ///
+ /// The source tensor of type T.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DeepCopy'.
+ ///
+ ///
+ /// y: A Tensor of type T. A copy of x. Guaranteed that y
+ /// is not an alias of x.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor deep_copy (Tensor x, string name = "DeepCopy")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ var op = _op_def_lib._apply_op_helper("DeepCopy", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Delete the tensor specified by its handle in the session.
+ ///
+ ///
+ /// The handle for a tensor stored in the session state.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DeleteSessionTensor'.
+ ///
+ ///
+ /// Returns the description of the operation
+ ///
+ public static Operation delete_session_tensor (Tensor handle, string name = "DeleteSessionTensor")
+ {
+ var dict = new Dictionary();
+ dict["handle"] = handle;
+ var op = _op_def_lib._apply_op_helper("DeleteSessionTensor", name: name, keywords: dict);
+ return op;
+ }
+
+ ///
+ /// Applies set operation along last dimension of 2 Tensor inputs.
+ ///
+ ///
+ /// Tensor with rank n. 1st n-1 dimensions must be the same as set2.
+ /// Dimension n contains values in a set, duplicates are allowed but ignored.
+ ///
+ ///
+ /// Tensor with rank n. 1st n-1 dimensions must be the same as set1.
+ /// Dimension n contains values in a set, duplicates are allowed but ignored.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DenseToDenseSetOperation'.
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ ///
+ ///
+ /// Returns a tuple with multiple values, as follows:
+ /// result_indices : 2D indices of a SparseTensor.
+ /// result_values : 1D values of a SparseTensor.
+ /// result_shape : 1D Tensor shape of a SparseTensor. result_shape[0...n-1] is
+ /// the same as the 1st n-1 dimensions of set1 and set2, result_shape[n]
+ /// is the max result set size across all 0...n-1 dimensions.
+ /// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
+ ///
+ ///
+ /// See SetOperationOp::SetOperationFromContext for values of set_operation.
+ ///
+ /// Output result is a SparseTensor represented by result_indices,
+ /// result_values, and result_shape. For set1 and set2 ranked n, this
+ /// has rank n and the same 1st n-1 dimensions as set1 and set2. The nth
+ /// dimension contains the result of set_operation applied to the corresponding
+ /// [0...n-1] dimension of set.
+ ///
+ public static (Tensor result_indices, Tensor result_values, Tensor result_shape) dense_to_dense_set_operation (Tensor set1, Tensor set2, string set_operation, bool? validate_indices = null, string name = "DenseToDenseSetOperation")
+ {
+ var dict = new Dictionary();
+ dict["set1"] = set1;
+ dict["set2"] = set2;
+ dict["set_operation"] = set_operation;
+ if (validate_indices.HasValue)
+ dict["validate_indices"] = validate_indices.Value;
+ var op = _op_def_lib._apply_op_helper("DenseToDenseSetOperation", name: name, keywords: dict);
+ int _idx = 0;
+ var result_indices = op.outputs[_idx++];
+ var result_values = op.outputs[_idx++];
+ var result_shape = op.outputs[_idx++];
+ return (result_indices, result_values, result_shape);
+ }
+
+ ///
+ /// Creates a dataset that batches input elements into a SparseTensor.
+ ///
+ ///
+ /// A handle to an input dataset. Must have a single component.
+ ///
+ ///
+ /// A scalar representing the number of elements to accumulate in a
+ /// batch.
+ ///
+ ///
+ /// A vector representing the dense shape of each row in the produced
+ /// SparseTensor. The shape may be partially specified, using -1 to indicate
+ /// that a particular dimension should use the maximum size of all batch elements.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DenseToSparseBatchDataset'.
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor dense_to_sparse_batch_dataset (Tensor input_dataset, Tensor batch_size, Tensor row_shape, TF_DataType[] output_types, TensorShape[] output_shapes, string name = "DenseToSparseBatchDataset")
+ {
+ var dict = new Dictionary();
+ dict["input_dataset"] = input_dataset;
+ dict["batch_size"] = batch_size;
+ dict["row_shape"] = row_shape;
+ dict["output_types"] = output_types;
+ dict["output_shapes"] = output_shapes;
+ var op = _op_def_lib._apply_op_helper("DenseToSparseBatchDataset", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Applies set operation along last dimension of Tensor and SparseTensor.
+ ///
+ ///
+ /// Tensor with rank n. 1st n-1 dimensions must be the same as set2.
+ /// Dimension n contains values in a set, duplicates are allowed but ignored.
+ ///
+ ///
+ /// 2D Tensor, indices of a SparseTensor. Must be in row-major
+ /// order.
+ ///
+ ///
+ /// 1D Tensor, values of a SparseTensor. Must be in row-major
+ /// order.
+ ///
+ ///
+ /// 1D Tensor, shape of a SparseTensor. set2_shape[0...n-1] must
+ /// be the same as the 1st n-1 dimensions of set1, result_shape[n] is the
+ /// max set size across n-1 dimensions.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DenseToSparseSetOperation'.
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ ///
+ ///
+ /// Returns a tuple with multiple values, as follows:
+ /// result_indices : 2D indices of a SparseTensor.
+ /// result_values : 1D values of a SparseTensor.
+ /// result_shape : 1D Tensor shape of a SparseTensor. result_shape[0...n-1] is
+ /// the same as the 1st n-1 dimensions of set1 and set2, result_shape[n]
+ /// is the max result set size across all 0...n-1 dimensions.
+ /// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
+ ///
+ ///
+ /// See SetOperationOp::SetOperationFromContext for values of set_operation.
+ ///
+ /// Input set2 is a SparseTensor represented by set2_indices, set2_values,
+ /// and set2_shape. For set2 ranked n, 1st n-1 dimensions must be the same
+ /// as set1. Dimension n contains values in a set, duplicates are allowed but
+ /// ignored.
+ ///
+ /// If validate_indices is True, this op validates the order and range of set2
+ /// indices.
+ ///
+ /// Output result is a SparseTensor represented by result_indices,
+ /// result_values, and result_shape. For set1 and set2 ranked n, this
+ /// has rank n and the same 1st n-1 dimensions as set1 and set2. The nth
+ /// dimension contains the result of set_operation applied to the corresponding
+ /// [0...n-1] dimension of set.
+ ///
+ public static (Tensor result_indices, Tensor result_values, Tensor result_shape) dense_to_sparse_set_operation (Tensor set1, Tensor set2_indices, Tensor set2_values, Tensor set2_shape, string set_operation, bool? validate_indices = null, string name = "DenseToSparseSetOperation")
+ {
+ var dict = new Dictionary();
+ dict["set1"] = set1;
+ dict["set2_indices"] = set2_indices;
+ dict["set2_values"] = set2_values;
+ dict["set2_shape"] = set2_shape;
+ dict["set_operation"] = set_operation;
+ if (validate_indices.HasValue)
+ dict["validate_indices"] = validate_indices.Value;
+ var op = _op_def_lib._apply_op_helper("DenseToSparseSetOperation", name: name, keywords: dict);
+ int _idx = 0;
+ var result_indices = op.outputs[_idx++];
+ var result_values = op.outputs[_idx++];
+ var result_shape = op.outputs[_idx++];
+ return (result_indices, result_values, result_shape);
+ }
+
+ ///
+ /// DepthToSpace for tensors of type T.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DepthToSpace'.
+ ///
+ ///
+ /// Optional argument
+ /// The size of the spatial block, same as in Space2Depth.
+ ///
+ ///
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Rearranges data from depth into blocks of spatial data.
+ /// This is the reverse transformation of SpaceToDepth. More specifically,
+ /// this op outputs a copy of the input tensor where values from the depth
+ /// dimension are moved in spatial blocks to the height and width dimensions.
+ /// The attr block_size indicates the input block size and how the data is moved.
+ ///
+ /// * Chunks of data of size block_size * block_size from depth are rearranged
+ /// into non-overlapping blocks of size block_size x block_size
+ /// * The width the output tensor is input_depth * block_size, whereas the
+ /// height is input_height * block_size.
+ /// * The Y, X coordinates within each block of the output image are determined
+ /// by the high order component of the input channel index.
+ /// * The depth of the input tensor must be divisible by
+ /// block_size * block_size.
+ ///
+ /// The data_format attr specifies the layout of the input and output tensors
+ /// with the following options:
+ /// "NHWC": [ batch, height, width, channels ]
+ /// "NCHW": [ batch, channels, height, width ]
+ /// "NCHW_VECT_C":
+ /// qint8 [ batch, channels / 4, height, width, 4 ]
+ ///
+ /// It is useful to consider the operation as transforming a 6-D Tensor.
+ /// e.g. for data_format = NHWC,
+ /// Each element in the input tensor can be specified via 6 coordinates,
+ /// ordered by decreasing memory layout significance as:
+ /// n,iY,iX,bY,bX,oC (where n=batch index, iX, iY means X or Y coordinates
+ /// within the input image, bX, bY means coordinates
+ /// within the output block, oC means output channels).
+ /// The output would be the input transposed to the following layout:
+ /// n,iY,bY,iX,bX,oC
+ ///
+ /// This operation is useful for resizing the activations between convolutions
+ /// (but keeping all data), e.g. instead of pooling. It is also useful for training
+ /// purely convolutional models.
+ ///
+ /// For example, given an input of shape [1, 1, 1, 4], data_format = "NHWC" and
+ /// block_size = 2:
+ ///
+ ///
+ /// x = [[[[1, 2, 3, 4]]]]
+ ///
+ ///
+ ///
+ /// This operation will output a tensor of shape [1, 2, 2, 1]:
+ ///
+ ///
+ /// [[[[1], [2]],
+ /// [[3], [4]]]]
+ ///
+ ///
+ /// Here, the input has a batch of 1 and each batch element has shape [1, 1, 4],
+ /// the corresponding output will have 2x2 elements and will have a depth of
+ /// 1 channel (1 = 4 / (block_size * block_size)).
+ /// The output element shape is [2, 2, 1].
+ ///
+ /// For an input tensor with larger depth, here of shape [1, 1, 1, 12], e.g.
+ ///
+ ///
+ /// x = [[[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]]]
+ ///
+ ///
+ /// This operation, for block size of 2, will return the following tensor of shape
+ /// [1, 2, 2, 3]
+ ///
+ ///
+ /// [[[[1, 2, 3], [4, 5, 6]],
+ /// [[7, 8, 9], [10, 11, 12]]]]
+ ///
+ ///
+ ///
+ /// Similarly, for the following input of shape [1 2 2 4], and a block size of 2:
+ ///
+ ///
+ /// x = [[[[1, 2, 3, 4],
+ /// [5, 6, 7, 8]],
+ /// [[9, 10, 11, 12],
+ /// [13, 14, 15, 16]]]]
+ ///
+ ///
+ /// the operator will return the following tensor of shape [1 4 4 1]:
+ ///
+ ///
+ /// x = [[[ [1], [2], [5], [6]],
+ /// [ [3], [4], [7], [8]],
+ /// [ [9], [10], [13], [14]],
+ /// [ [11], [12], [15], [16]]]]
+ ///
+ ///
+ ///
+ public static Tensor depth_to_space (Tensor input, int block_size, string data_format = null, string name = "DepthToSpace")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["block_size"] = block_size;
+ if (data_format != null)
+ dict["data_format"] = data_format;
+ var op = _op_def_lib._apply_op_helper("DepthToSpace", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes a 2-D depthwise convolution given 4-D input and filter tensors.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DepthwiseConv2dNative'.
+ ///
+ ///
+ /// Optional argument
+ /// 1-D of length 4. The stride of the sliding window for each dimension
+ /// of input.
+ ///
+ ///
+ /// Optional argument
+ /// The type of padding algorithm to use.
+ ///
+ ///
+ /// Specify the data format of the input and output data. With the
+ /// default format "NHWC", the data is stored in the order of:
+ /// [batch, height, width, channels].
+ /// Alternatively, the format could be "NCHW", the data storage order of:
+ /// [batch, channels, height, width].
+ ///
+ ///
+ /// 1-D tensor of length 4. The dilation factor for each dimension of
+ /// input. If set to k > 1, there will be k-1 skipped cells between each filter
+ /// element on that dimension. The dimension order is determined by the value of
+ /// data_format, see above for details. Dilations in the batch and depth
+ /// dimensions must be 1.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Given an input tensor of shape [batch, in_height, in_width, in_channels]
+ /// and a filter / kernel tensor of shape
+ /// [filter_height, filter_width, in_channels, channel_multiplier], containing
+ /// in_channels convolutional filters of depth 1, depthwise_conv2d applies
+ /// a different filter to each input channel (expanding from 1 channel to
+ /// channel_multiplier channels for each), then concatenates the results
+ /// together. Thus, the output has in_channels * channel_multiplier channels.
+ ///
+ ///
+ /// for k in 0..in_channels-1
+ /// for q in 0..channel_multiplier-1
+ /// output[b, i, j, k * channel_multiplier + q] =
+ /// sum_{di, dj} input[b, strides[1] * i + di, strides[2] * j + dj, k] *
+ /// filter[di, dj, k, q]
+ ///
+ ///
+ /// Must have strides[0] = strides[3] = 1. For the most common case of the same
+ /// horizontal and vertices strides, strides = [1, stride, stride, 1].
+ ///
+ public static Tensor depthwise_conv2d_native (Tensor input, Tensor filter, int[] strides, string padding, string data_format = null, int[] dilations = null, string name = "DepthwiseConv2dNative")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["filter"] = filter;
+ dict["strides"] = strides;
+ dict["padding"] = padding;
+ if (data_format != null)
+ dict["data_format"] = data_format;
+ if (dilations != null)
+ dict["dilations"] = dilations;
+ var op = _op_def_lib._apply_op_helper("DepthwiseConv2dNative", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes the gradients of depthwise convolution with respect to the filter.
+ ///
+ ///
+ /// 4-D with shape based on data_format. For example, if
+ /// data_format is 'NHWC' then input is a 4-D [batch, in_height,
+ /// in_width, in_channels] tensor.
+ ///
+ ///
+ /// An integer vector representing the tensor shape of filter,
+ /// where filter is a 4-D
+ /// [filter_height, filter_width, in_channels, depthwise_multiplier] tensor.
+ ///
+ ///
+ /// 4-D with shape based on data_format.
+ /// For example, if data_format is 'NHWC' then
+ /// out_backprop shape is [batch, out_height, out_width, out_channels].
+ /// Gradients w.r.t. the output of the convolution.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DepthwiseConv2dNativeBackpropFilter'.
+ ///
+ ///
+ /// Optional argument
+ /// The stride of the sliding window for each dimension of the input
+ /// of the convolution.
+ ///
+ ///
+ /// Optional argument
+ /// The type of padding algorithm to use.
+ ///
+ ///
+ /// Specify the data format of the input and output data. With the
+ /// default format "NHWC", the data is stored in the order of:
+ /// [batch, height, width, channels].
+ /// Alternatively, the format could be "NCHW", the data storage order of:
+ /// [batch, channels, height, width].
+ ///
+ ///
+ /// 1-D tensor of length 4. The dilation factor for each dimension of
+ /// input. If set to k > 1, there will be k-1 skipped cells between each filter
+ /// element on that dimension. The dimension order is determined by the value of
+ /// data_format, see above for details. Dilations in the batch and depth
+ /// dimensions must be 1.
+ ///
+ ///
+ /// 4-D with shape
+ /// [filter_height, filter_width, in_channels, out_channels]. Gradient w.r.t.
+ /// the filter input of the convolution.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor depthwise_conv2d_native_backprop_filter (Tensor input, Tensor filter_sizes, Tensor out_backprop, int[] strides, string padding, string data_format = null, int[] dilations = null, string name = "DepthwiseConv2dNativeBackpropFilter")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["filter_sizes"] = filter_sizes;
+ dict["out_backprop"] = out_backprop;
+ dict["strides"] = strides;
+ dict["padding"] = padding;
+ if (data_format != null)
+ dict["data_format"] = data_format;
+ if (dilations != null)
+ dict["dilations"] = dilations;
+ var op = _op_def_lib._apply_op_helper("DepthwiseConv2dNativeBackpropFilter", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes the gradients of depthwise convolution with respect to the input.
+ ///
+ ///
+ /// An integer vector representing the shape of input, based
+ /// on data_format. For example, if data_format is 'NHWC' then
+ /// input is a 4-D [batch, height, width, channels] tensor.
+ ///
+ ///
+ /// 4-D with shape
+ /// [filter_height, filter_width, in_channels, depthwise_multiplier].
+ ///
+ ///
+ /// 4-D with shape based on data_format.
+ /// For example, if data_format is 'NHWC' then
+ /// out_backprop shape is [batch, out_height, out_width, out_channels].
+ /// Gradients w.r.t. the output of the convolution.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DepthwiseConv2dNativeBackpropInput'.
+ ///
+ ///
+ /// Optional argument
+ /// The stride of the sliding window for each dimension of the input
+ /// of the convolution.
+ ///
+ ///
+ /// Optional argument
+ /// The type of padding algorithm to use.
+ ///
+ ///
+ /// Specify the data format of the input and output data. With the
+ /// default format "NHWC", the data is stored in the order of:
+ /// [batch, height, width, channels].
+ /// Alternatively, the format could be "NCHW", the data storage order of:
+ /// [batch, channels, height, width].
+ ///
+ ///
+ /// 1-D tensor of length 4. The dilation factor for each dimension of
+ /// input. If set to k > 1, there will be k-1 skipped cells between each filter
+ /// element on that dimension. The dimension order is determined by the value of
+ /// data_format, see above for details. Dilations in the batch and depth
+ /// dimensions must be 1.
+ ///
+ ///
+ /// 4-D with shape according to data_format. For example, if
+ /// data_format is 'NHWC', output shape is [batch, in_height,
+ /// in_width, in_channels]. Gradient w.r.t. the input of the
+ /// convolution.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor depthwise_conv2d_native_backprop_input (Tensor input_sizes, Tensor filter, Tensor out_backprop, int[] strides, string padding, string data_format = null, int[] dilations = null, string name = "DepthwiseConv2dNativeBackpropInput")
+ {
+ var dict = new Dictionary();
+ dict["input_sizes"] = input_sizes;
+ dict["filter"] = filter;
+ dict["out_backprop"] = out_backprop;
+ dict["strides"] = strides;
+ dict["padding"] = padding;
+ if (data_format != null)
+ dict["data_format"] = data_format;
+ if (dilations != null)
+ dict["dilations"] = dilations;
+ var op = _op_def_lib._apply_op_helper("DepthwiseConv2dNativeBackpropInput", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Dequantize the 'input' tensor into a float Tensor.
+ ///
+ ///
+ ///
+ ///
+ /// The minimum scalar value possibly produced for the input.
+ ///
+ ///
+ /// The maximum scalar value possibly produced for the input.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Dequantize'.
+ ///
+ ///
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// [min_range, max_range] are scalar floats that specify the range for
+ /// the 'input' data. The 'mode' attribute controls exactly which calculations are
+ /// used to convert the float values to their quantized equivalents.
+ ///
+ /// In 'MIN_COMBINED' mode, each value of the tensor will undergo the following:
+ ///
+ ///
+ /// if T == qint8, in[i] += (range(T) + 1)/ 2.0
+ /// out[i] = min_range + (in[i]* (max_range - min_range) / range(T))
+ ///
+ /// here range(T) = numeric_limits<T>::max() - numeric_limits<T>::min()
+ ///
+ /// *MIN_COMBINED Mode Example*
+ ///
+ /// If the input comes from a QuantizedRelu6, the output type is
+ /// quint8 (range of 0-255) but the possible range of QuantizedRelu6 is
+ /// 0-6. The min_range and max_range values are therefore 0.0 and 6.0.
+ /// Dequantize on quint8 will take each value, cast to float, and multiply
+ /// by 6 / 255.
+ /// Note that if quantizedtype is qint8, the operation will additionally add
+ /// each value by 128 prior to casting.
+ ///
+ /// If the mode is 'MIN_FIRST', then this approach is used:
+ ///
+ ///
+ /// num_discrete_values = 1 << (# of bits in T)
+ /// range_adjust = num_discrete_values / (num_discrete_values - 1)
+ /// range = (range_max - range_min) * range_adjust
+ /// range_scale = range / num_discrete_values
+ /// const double offset_input = static_cast<double>(input) - lowest_quantized;
+ /// result = range_min + ((input - numeric_limits<T>::min()) * range_scale)
+ ///
+ ///
+ /// *SCALED mode Example*
+ ///
+ /// SCALED mode matches the quantization approach used in
+ /// QuantizeAndDequantize{V2|V3}.
+ ///
+ /// If the mode is SCALED, we do not use the full range of the output type,
+ /// choosing to elide the lowest possible value for symmetry (e.g., output range is
+ /// -127 to 127, not -128 to 127 for signed 8 bit quantization), so that 0.0 maps to
+ /// 0.
+ ///
+ /// We first find the range of values in our tensor. The
+ /// range we use is always centered on 0, so we find m such that
+ ///
+ /// m = max(abs(input_min), abs(input_max))
+ ///
+ ///
+ /// Our input tensor range is then [-m, m].
+ ///
+ /// Next, we choose our fixed-point quantization buckets, [min_fixed, max_fixed].
+ /// If T is signed, this is
+ ///
+ /// num_bits = sizeof(T) * 8
+ /// [min_fixed, max_fixed] =
+ /// [-(1 << (num_bits - 1) - 1), (1 << (num_bits - 1)) - 1]
+ ///
+ ///
+ /// Otherwise, if T is unsigned, the fixed-point range is
+ ///
+ /// [min_fixed, max_fixed] = [0, (1 << num_bits) - 1]
+ ///
+ ///
+ /// From this we compute our scaling factor, s:
+ ///
+ /// s = (2 * m) / (max_fixed - min_fixed)
+ ///
+ ///
+ /// Now we can dequantize the elements of our tensor:
+ ///
+ /// result = input * s
+ ///
+ ///
+ public static Tensor dequantize (Tensor input, Tensor min_range, Tensor max_range, string mode = null, string name = "Dequantize")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["min_range"] = min_range;
+ dict["max_range"] = max_range;
+ if (mode != null)
+ dict["mode"] = mode;
+ var op = _op_def_lib._apply_op_helper("Dequantize", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Converts the given variant tensor to an iterator and stores it in the given resource.
+ ///
+ ///
+ /// A handle to an iterator resource.
+ ///
+ ///
+ /// A variant tensor storing the state of the iterator contained in the
+ /// resource.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DeserializeIterator'.
+ ///
+ ///
+ /// Returns the description of the operation
+ ///
+ public static Operation deserialize_iterator (Tensor resource_handle, Tensor serialized, string name = "DeserializeIterator")
+ {
+ var dict = new Dictionary();
+ dict["resource_handle"] = resource_handle;
+ dict["serialized"] = serialized;
+ var op = _op_def_lib._apply_op_helper("DeserializeIterator", name: name, keywords: dict);
+ return op;
+ }
+
+ ///
+ /// Deserialize and concatenate SparseTensors from a serialized minibatch.
+ ///
+ ///
+ /// 2-D, The N serialized SparseTensor objects.
+ /// Must have 3 columns.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DeserializeManySparse'.
+ ///
+ ///
+ /// Optional argument
+ /// The dtype of the serialized SparseTensor objects.
+ ///
+ ///
+ /// Returns a tuple with multiple values, as follows:
+ /// sparse_indices :
+ /// sparse_values :
+ /// sparse_shape :
+ /// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
+ ///
+ ///
+ /// The input serialized_sparse must be a string matrix of shape [N x 3] where
+ /// N is the minibatch size and the rows correspond to packed outputs of
+ /// SerializeSparse. The ranks of the original SparseTensor objects
+ /// must all match. When the final SparseTensor is created, it has rank one
+ /// higher than the ranks of the incoming SparseTensor objects
+ /// (they have been concatenated along a new row dimension).
+ ///
+ /// The output SparseTensor object's shape values for all dimensions but the
+ /// first are the max across the input SparseTensor objects' shape values
+ /// for the corresponding dimensions. Its first shape value is N, the minibatch
+ /// size.
+ ///
+ /// The input SparseTensor objects' indices are assumed ordered in
+ /// standard lexicographic order. If this is not the case, after this
+ /// step run SparseReorder to restore index ordering.
+ ///
+ /// For example, if the serialized input is a [2 x 3] matrix representing two
+ /// original SparseTensor objects:
+ ///
+ /// index = [ 0]
+ /// [10]
+ /// [20]
+ /// values = [1, 2, 3]
+ /// shape = [50]
+ ///
+ /// and
+ ///
+ /// index = [ 2]
+ /// [10]
+ /// values = [4, 5]
+ /// shape = [30]
+ ///
+ /// then the final deserialized SparseTensor will be:
+ ///
+ /// index = [0 0]
+ /// [0 10]
+ /// [0 20]
+ /// [1 2]
+ /// [1 10]
+ /// values = [1, 2, 3, 4, 5]
+ /// shape = [2 50]
+ ///
+ public static (Tensor sparse_indices, Tensor sparse_values, Tensor sparse_shape) deserialize_many_sparse (Tensor serialized_sparse, TF_DataType dtype, string name = "DeserializeManySparse")
+ {
+ var dict = new Dictionary();
+ dict["serialized_sparse"] = serialized_sparse;
+ dict["dtype"] = dtype;
+ var op = _op_def_lib._apply_op_helper("DeserializeManySparse", name: name, keywords: dict);
+ int _idx = 0;
+ var sparse_indices = op.outputs[_idx++];
+ var sparse_values = op.outputs[_idx++];
+ var sparse_shape = op.outputs[_idx++];
+ return (sparse_indices, sparse_values, sparse_shape);
+ }
+
+ ///
+ /// Deserialize SparseTensor objects.
+ ///
+ ///
+ /// The serialized SparseTensor objects. The last dimension
+ /// must have 3 columns.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DeserializeSparse'.
+ ///
+ ///
+ /// Optional argument
+ /// The dtype of the serialized SparseTensor objects.
+ ///
+ ///
+ /// Returns a tuple with multiple values, as follows:
+ /// sparse_indices :
+ /// sparse_values :
+ /// sparse_shape :
+ /// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
+ ///
+ ///
+ /// The input serialized_sparse must have the shape [?, ?, ..., ?, 3] where
+ /// the last dimension stores serialized SparseTensor objects and the other N
+ /// dimensions (N >= 0) correspond to a batch. The ranks of the original
+ /// SparseTensor objects must all match. When the final SparseTensor is
+ /// created, its rank is the rank of the incoming SparseTensor objects plus N;
+ /// the sparse tensors have been concatenated along new dimensions, one for each
+ /// batch.
+ ///
+ /// The output SparseTensor object's shape values for the original dimensions
+ /// are the max across the input SparseTensor objects' shape values for the
+ /// corresponding dimensions. The new dimensions match the size of the batch.
+ ///
+ /// The input SparseTensor objects' indices are assumed ordered in
+ /// standard lexicographic order. If this is not the case, after this
+ /// step run SparseReorder to restore index ordering.
+ ///
+ /// For example, if the serialized input is a [2 x 3] matrix representing two
+ /// original SparseTensor objects:
+ ///
+ /// index = [ 0]
+ /// [10]
+ /// [20]
+ /// values = [1, 2, 3]
+ /// shape = [50]
+ ///
+ /// and
+ ///
+ /// index = [ 2]
+ /// [10]
+ /// values = [4, 5]
+ /// shape = [30]
+ ///
+ /// then the final deserialized SparseTensor will be:
+ ///
+ /// index = [0 0]
+ /// [0 10]
+ /// [0 20]
+ /// [1 2]
+ /// [1 10]
+ /// values = [1, 2, 3, 4, 5]
+ /// shape = [2 50]
+ ///
+ public static (Tensor sparse_indices, Tensor sparse_values, Tensor sparse_shape) deserialize_sparse (Tensor serialized_sparse, TF_DataType dtype, string name = "DeserializeSparse")
+ {
+ var dict = new Dictionary();
+ dict["serialized_sparse"] = serialized_sparse;
+ dict["dtype"] = dtype;
+ var op = _op_def_lib._apply_op_helper("DeserializeSparse", name: name, keywords: dict);
+ int _idx = 0;
+ var sparse_indices = op.outputs[_idx++];
+ var sparse_values = op.outputs[_idx++];
+ var sparse_shape = op.outputs[_idx++];
+ return (sparse_indices, sparse_values, sparse_shape);
+ }
+
+ ///
+ /// Deletes the resource specified by the handle.
+ ///
+ ///
+ /// handle to the resource to delete.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DestroyResourceOp'.
+ ///
+ ///
+ /// whether to ignore the error when the resource
+ /// doesn't exist.
+ ///
+ ///
+ /// Returns the description of the operation
+ ///
+ ///
+ /// All subsequent operations using the resource will result in a NotFound
+ /// error status.
+ ///
+ public static Operation destroy_resource_op (Tensor resource, bool? ignore_lookup_error = null, string name = "DestroyResourceOp")
+ {
+ var dict = new Dictionary();
+ dict["resource"] = resource;
+ if (ignore_lookup_error.HasValue)
+ dict["ignore_lookup_error"] = ignore_lookup_error.Value;
+ var op = _op_def_lib._apply_op_helper("DestroyResourceOp", name: name, keywords: dict);
+ return op;
+ }
+
+ ///
+ /// Destroys the temporary variable and returns its final value.
+ ///
+ ///
+ /// A reference to the temporary variable tensor.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DestroyTemporaryVariable'.
+ ///
+ ///
+ /// Optional argument
+ /// Name of the temporary variable, usually the name of the matching
+ /// 'TemporaryVariable' op.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Sets output to the value of the Tensor pointed to by 'ref', then destroys
+ /// the temporary variable called 'var_name'.
+ /// All other uses of 'ref' *must* have executed before this op.
+ /// This is typically achieved by chaining the ref through each assign op, or by
+ /// using control dependencies.
+ ///
+ /// Outputs the final value of the tensor pointed to by 'ref'.
+ ///
+ public static Tensor destroy_temporary_variable (Tensor referecne, string var_name, string name = "DestroyTemporaryVariable")
+ {
+ var dict = new Dictionary();
+ dict["ref"] = referecne;
+ dict["var_name"] = var_name;
+ var op = _op_def_lib._apply_op_helper("DestroyTemporaryVariable", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Returns a diagonal tensor with a given diagonal values.
+ ///
+ ///
+ /// Rank k tensor where k is at most 1.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Diag'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Given a diagonal, this operation returns a tensor with the diagonal and
+ /// everything else padded with zeros. The diagonal is computed as follows:
+ ///
+ /// Assume diagonal has dimensions [D1,..., Dk], then the output is a tensor of
+ /// rank 2k with dimensions [D1,..., Dk, D1,..., Dk] where:
+ ///
+ /// output[i1,..., ik, i1,..., ik] = diagonal[i1, ..., ik] and 0 everywhere else.
+ ///
+ /// For example:
+ ///
+ ///
+ /// # 'diagonal' is [1, 2, 3, 4]
+ /// tf.diag(diagonal) ==> [[1, 0, 0, 0]
+ /// [0, 2, 0, 0]
+ /// [0, 0, 3, 0]
+ /// [0, 0, 0, 4]]
+ ///
+ ///
+ public static Tensor diag (Tensor diagonal, string name = "Diag")
+ {
+ var dict = new Dictionary();
+ dict["diagonal"] = diagonal;
+ var op = _op_def_lib._apply_op_helper("Diag", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Returns the diagonal part of the tensor.
+ ///
+ ///
+ /// Rank k tensor where k is even and not zero.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DiagPart'.
+ ///
+ ///
+ /// The extracted diagonal.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// This operation returns a tensor with the diagonal part
+ /// of the input. The diagonal part is computed as follows:
+ ///
+ /// Assume input has dimensions [D1,..., Dk, D1,..., Dk], then the output is a
+ /// tensor of rank k with dimensions [D1,..., Dk] where:
+ ///
+ /// diagonal[i1,..., ik] = input[i1, ..., ik, i1,..., ik].
+ ///
+ /// For example:
+ ///
+ ///
+ /// # 'input' is [[1, 0, 0, 0]
+ /// [0, 2, 0, 0]
+ /// [0, 0, 3, 0]
+ /// [0, 0, 0, 4]]
+ ///
+ /// tf.diag_part(input) ==> [1, 2, 3, 4]
+ ///
+ ///
+ public static Tensor diag_part (Tensor input, string name = "DiagPart")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ var op = _op_def_lib._apply_op_helper("DiagPart", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes Psi, the derivative of Lgamma (the log of the absolute value of
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Digamma'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Gamma(x)), element-wise.
+ ///
+ public static Tensor digamma (Tensor x, string name = "Digamma")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ var op = _op_def_lib._apply_op_helper("Digamma", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes the grayscale dilation of 4-D input and 3-D filter tensors.
+ ///
+ ///
+ /// 4-D with shape [batch, in_height, in_width, depth].
+ ///
+ ///
+ /// 3-D with shape [filter_height, filter_width, depth].
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Dilation2D'.
+ ///
+ ///
+ /// Optional argument
+ /// The stride of the sliding window for each dimension of the input
+ /// tensor. Must be: [1, stride_height, stride_width, 1].
+ ///
+ ///
+ /// Optional argument
+ /// The input stride for atrous morphological dilation. Must be:
+ /// [1, rate_height, rate_width, 1].
+ ///
+ ///
+ /// Optional argument
+ /// The type of padding algorithm to use.
+ ///
+ ///
+ /// 4-D with shape [batch, out_height, out_width, depth].
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// The input tensor has shape [batch, in_height, in_width, depth] and the
+ /// filter tensor has shape [filter_height, filter_width, depth], i.e., each
+ /// input channel is processed independently of the others with its own structuring
+ /// function. The output tensor has shape
+ /// [batch, out_height, out_width, depth]. The spatial dimensions of the output
+ /// tensor depend on the padding algorithm. We currently only support the default
+ /// "NHWC" data_format.
+ ///
+ /// In detail, the grayscale morphological 2-D dilation is the max-sum correlation
+ /// (for consistency with conv2d, we use unmirrored filters):
+ ///
+ /// output[b, y, x, c] =
+ /// max_{dy, dx} input[b,
+ /// strides[1] * y + rates[1] * dy,
+ /// strides[2] * x + rates[2] * dx,
+ /// c] +
+ /// filter[dy, dx, c]
+ ///
+ /// Max-pooling is a special case when the filter has size equal to the pooling
+ /// kernel size and contains all zeros.
+ ///
+ /// Note on duality: The dilation of input by the filter is equal to the
+ /// negation of the erosion of -input by the reflected filter.
+ ///
+ public static Tensor dilation2d (Tensor input, Tensor filter, int[] strides, int[] rates, string padding, string name = "Dilation2D")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["filter"] = filter;
+ dict["strides"] = strides;
+ dict["rates"] = rates;
+ dict["padding"] = padding;
+ var op = _op_def_lib._apply_op_helper("Dilation2D", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes the gradient of morphological 2-D dilation with respect to the filter.
+ ///
+ ///
+ /// 4-D with shape [batch, in_height, in_width, depth].
+ ///
+ ///
+ /// 3-D with shape [filter_height, filter_width, depth].
+ ///
+ ///
+ /// 4-D with shape [batch, out_height, out_width, depth].
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Dilation2DBackpropFilter'.
+ ///
+ ///
+ /// Optional argument
+ /// 1-D of length 4. The stride of the sliding window for each dimension of
+ /// the input tensor. Must be: [1, stride_height, stride_width, 1].
+ ///
+ ///
+ /// Optional argument
+ /// 1-D of length 4. The input stride for atrous morphological dilation.
+ /// Must be: [1, rate_height, rate_width, 1].
+ ///
+ ///
+ /// Optional argument
+ /// The type of padding algorithm to use.
+ ///
+ ///
+ /// 3-D with shape [filter_height, filter_width, depth].
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor dilation2d_backprop_filter (Tensor input, Tensor filter, Tensor out_backprop, int[] strides, int[] rates, string padding, string name = "Dilation2DBackpropFilter")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["filter"] = filter;
+ dict["out_backprop"] = out_backprop;
+ dict["strides"] = strides;
+ dict["rates"] = rates;
+ dict["padding"] = padding;
+ var op = _op_def_lib._apply_op_helper("Dilation2DBackpropFilter", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes the gradient of morphological 2-D dilation with respect to the input.
+ ///
+ ///
+ /// 4-D with shape [batch, in_height, in_width, depth].
+ ///
+ ///
+ /// 3-D with shape [filter_height, filter_width, depth].
+ ///
+ ///
+ /// 4-D with shape [batch, out_height, out_width, depth].
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Dilation2DBackpropInput'.
+ ///
+ ///
+ /// Optional argument
+ /// 1-D of length 4. The stride of the sliding window for each dimension of
+ /// the input tensor. Must be: [1, stride_height, stride_width, 1].
+ ///
+ ///
+ /// Optional argument
+ /// 1-D of length 4. The input stride for atrous morphological dilation.
+ /// Must be: [1, rate_height, rate_width, 1].
+ ///
+ ///
+ /// Optional argument
+ /// The type of padding algorithm to use.
+ ///
+ ///
+ /// 4-D with shape [batch, in_height, in_width, depth].
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor dilation2d_backprop_input (Tensor input, Tensor filter, Tensor out_backprop, int[] strides, int[] rates, string padding, string name = "Dilation2DBackpropInput")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["filter"] = filter;
+ dict["out_backprop"] = out_backprop;
+ dict["strides"] = strides;
+ dict["rates"] = rates;
+ dict["padding"] = padding;
+ var op = _op_def_lib._apply_op_helper("Dilation2DBackpropInput", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Returns x / y element-wise.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Div'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// *NOTE*: Div supports broadcasting. More about broadcasting
+ /// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html)
+ ///
+ public static Tensor div (Tensor x, Tensor y, string name = "Div")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ dict["y"] = y;
+ var op = _op_def_lib._apply_op_helper("Div", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Returns 0 if the denominator is zero.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DivNoNan'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ ///
+ /// *NOTE*: DivNoNan supports broadcasting. More about broadcasting
+ /// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html)
+ ///
+ public static Tensor div_no_nan (Tensor x, Tensor y, string name = "DivNoNan")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ dict["y"] = y;
+ var op = _op_def_lib._apply_op_helper("DivNoNan", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Draw bounding boxes on a batch of images.
+ ///
+ ///
+ /// 4-D with shape [batch, height, width, depth]. A batch of images.
+ ///
+ ///
+ /// 3-D with shape [batch, num_bounding_boxes, 4] containing bounding
+ /// boxes.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DrawBoundingBoxes'.
+ ///
+ ///
+ /// 4-D with the same shape as images. The batch of input images with
+ /// bounding boxes drawn on the images.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Outputs a copy of images but draws on top of the pixels zero or more bounding
+ /// boxes specified by the locations in boxes. The coordinates of the each
+ /// bounding box in boxes are encoded as [y_min, x_min, y_max, x_max]. The
+ /// bounding box coordinates are floats in [0.0, 1.0] relative to the width and
+ /// height of the underlying image.
+ ///
+ /// For example, if an image is 100 x 200 pixels (height x width) and the bounding
+ /// box is [0.1, 0.2, 0.5, 0.9], the upper-left and bottom-right coordinates of
+ /// the bounding box will be (40, 10) to (180, 50) (in (x,y) coordinates).
+ ///
+ /// Parts of the bounding box may fall outside the image.
+ ///
+ public static Tensor draw_bounding_boxes (Tensor images, Tensor boxes, string name = "DrawBoundingBoxes")
+ {
+ var dict = new Dictionary();
+ dict["images"] = images;
+ dict["boxes"] = boxes;
+ var op = _op_def_lib._apply_op_helper("DrawBoundingBoxes", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Partitions data into num_partitions tensors using indices from partitions.
+ ///
+ ///
+ ///
+ ///
+ /// Any shape. Indices in the range [0, num_partitions).
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DynamicPartition'.
+ ///
+ ///
+ /// Optional argument
+ /// The number of partitions to output.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// For each index tuple js of size partitions.ndim, the slice data[js, ...]
+ /// becomes part of outputs[partitions[js]]. The slices with partitions[js] = i
+ /// are placed in outputs[i] in lexicographic order of js, and the first
+ /// dimension of outputs[i] is the number of entries in partitions equal to i.
+ /// In detail,
+ ///
+ ///
+ /// outputs[i].shape = [sum(partitions == i)] + data.shape[partitions.ndim:]
+ ///
+ /// outputs[i] = pack([data[js, ...] for js if partitions[js] == i])
+ ///
+ ///
+ /// data.shape must start with partitions.shape.
+ ///
+ /// For example:
+ ///
+ ///
+ /// # Scalar partitions.
+ /// partitions = 1
+ /// num_partitions = 2
+ /// data = [10, 20]
+ /// outputs[0] = [] # Empty with shape [0, 2]
+ /// outputs[1] = [[10, 20]]
+ ///
+ /// # Vector partitions.
+ /// partitions = [0, 0, 1, 1, 0]
+ /// num_partitions = 2
+ /// data = [10, 20, 30, 40, 50]
+ /// outputs[0] = [10, 20, 50]
+ /// outputs[1] = [30, 40]
+ ///
+ ///
+ /// See dynamic_stitch for an example on how to merge partitions back.
+ ///
+ /// <div style="width:70%; margin:auto; margin-bottom:10px; margin-top:20px;">
+ /// <img style="width:100%" src="https://www.tensorflow.org/images/DynamicPartition.png" alt>
+ /// </div>
+ ///
+ public static Tensor[] dynamic_partition (Tensor data, Tensor partitions, int num_partitions, string name = "DynamicPartition")
+ {
+ var dict = new Dictionary();
+ dict["data"] = data;
+ dict["partitions"] = partitions;
+ dict["num_partitions"] = num_partitions;
+ var op = _op_def_lib._apply_op_helper("DynamicPartition", name: name, keywords: dict);
+ int _idx = 0;
+ var outputs = Enumerable.Range(0, op.OutputListLength("outputs")).Select(_ => op.outputs[_idx++]).ToArray();
+ return (outputs);
+ }
+
+ ///
+ /// Interleave the values from the data tensors into a single tensor.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DynamicStitch'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Builds a merged tensor such that
+ ///
+ ///
+ /// merged[indices[m][i, ..., j], ...] = data[m][i, ..., j, ...]
+ ///
+ ///
+ /// For example, if each indices[m] is scalar or vector, we have
+ ///
+ ///
+ /// # Scalar indices:
+ /// merged[indices[m], ...] = data[m][...]
+ ///
+ /// # Vector indices:
+ /// merged[indices[m][i], ...] = data[m][i, ...]
+ ///
+ ///
+ /// Each data[i].shape must start with the corresponding indices[i].shape,
+ /// and the rest of data[i].shape must be constant w.r.t. i. That is, we
+ /// must have data[i].shape = indices[i].shape + constant. In terms of this
+ /// constant, the output shape is
+ ///
+ /// merged.shape = [max(indices)] + constant
+ ///
+ /// Values are merged in order, so if an index appears in both indices[m][i] and
+ /// indices[n][j] for (m,i) < (n,j) the slice data[n][j] will appear in the
+ /// merged result. If you do not need this guarantee, ParallelDynamicStitch might
+ /// perform better on some devices.
+ ///
+ /// For example:
+ ///
+ ///
+ /// indices[0] = 6
+ /// indices[1] = [4, 1]
+ /// indices[2] = [[5, 2], [0, 3]]
+ /// data[0] = [61, 62]
+ /// data[1] = [[41, 42], [11, 12]]
+ /// data[2] = [[[51, 52], [21, 22]], [[1, 2], [31, 32]]]
+ /// merged = [[1, 2], [11, 12], [21, 22], [31, 32], [41, 42],
+ /// [51, 52], [61, 62]]
+ ///
+ ///
+ /// This method can be used to merge partitions created by dynamic_partition
+ /// as illustrated on the following example:
+ ///
+ ///
+ /// # Apply function (increments x_i) on elements for which a certain condition
+ /// # apply (x_i != -1 in this example).
+ /// x=tf.constant([0.1, -1., 5.2, 4.3, -1., 7.4])
+ /// condition_mask=tf.not_equal(x,tf.constant(-1.))
+ /// partitioned_data = tf.dynamic_partition(
+ /// x, tf.cast(condition_mask, tf.int32) , 2)
+ /// partitioned_data[1] = partitioned_data[1] + 1.0
+ /// condition_indices = tf.dynamic_partition(
+ /// tf.range(tf.shape(x)[0]), tf.cast(condition_mask, tf.int32) , 2)
+ /// x = tf.dynamic_stitch(condition_indices, partitioned_data)
+ /// # Here x=[1.1, -1., 6.2, 5.3, -1, 8.4], the -1. values remain
+ /// # unchanged.
+ ///
+ ///
+ /// <div style="width:70%; margin:auto; margin-bottom:10px; margin-top:20px;">
+ /// <img style="width:100%" src="https://www.tensorflow.org/images/DynamicStitch.png" alt>
+ /// </div>
+ ///
+ public static Tensor dynamic_stitch (Tensor[] indices, Tensor[] data, string name = "DynamicStitch")
+ {
+ var dict = new Dictionary();
+ dict["indices"] = indices;
+ dict["data"] = data;
+ var op = _op_def_lib._apply_op_helper("DynamicStitch", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes the (possibly normalized) Levenshtein Edit Distance.
+ ///
+ ///
+ /// The indices of the hypothesis list SparseTensor.
+ /// This is an N x R int64 matrix.
+ ///
+ ///
+ /// The values of the hypothesis list SparseTensor.
+ /// This is an N-length vector.
+ ///
+ ///
+ /// The shape of the hypothesis list SparseTensor.
+ /// This is an R-length vector.
+ ///
+ ///
+ /// The indices of the truth list SparseTensor.
+ /// This is an M x R int64 matrix.
+ ///
+ ///
+ /// The values of the truth list SparseTensor.
+ /// This is an M-length vector.
+ ///
+ ///
+ /// truth indices, vector.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'EditDistance'.
+ ///
+ ///
+ /// boolean (if true, edit distances are normalized by length of truth).
+ ///
+ /// The output is:
+ ///
+ ///
+ /// A dense float tensor with rank R - 1.
+ ///
+ /// For the example input:
+ ///
+ /// // hypothesis represents a 2x1 matrix with variable-length values:
+ /// // (0,0) = ["a"]
+ /// // (1,0) = ["b"]
+ /// hypothesis_indices = [[0, 0, 0],
+ /// [1, 0, 0]]
+ /// hypothesis_values = ["a", "b"]
+ /// hypothesis_shape = [2, 1, 1]
+ ///
+ /// // truth represents a 2x2 matrix with variable-length values:
+ /// // (0,0) = []
+ /// // (0,1) = ["a"]
+ /// // (1,0) = ["b", "c"]
+ /// // (1,1) = ["a"]
+ /// truth_indices = [[0, 1, 0],
+ /// [1, 0, 0],
+ /// [1, 0, 1],
+ /// [1, 1, 0]]
+ /// truth_values = ["a", "b", "c", "a"]
+ /// truth_shape = [2, 2, 2]
+ /// normalize = true
+ ///
+ /// The output will be:
+ ///
+ /// // output is a 2x2 matrix with edit distances normalized by truth lengths.
+ /// output = [[inf, 1.0], // (0,0): no truth, (0,1): no hypothesis
+ /// [0.5, 1.0]] // (1,0): addition, (1,1): no hypothesis
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// The inputs are variable-length sequences provided by SparseTensors
+ /// (hypothesis_indices, hypothesis_values, hypothesis_shape)
+ /// and
+ /// (truth_indices, truth_values, truth_shape).
+ ///
+ /// The inputs are:
+ ///
+ public static Tensor edit_distance (Tensor hypothesis_indices, Tensor hypothesis_values, Tensor hypothesis_shape, Tensor truth_indices, Tensor truth_values, Tensor truth_shape, bool? normalize = null, string name = "EditDistance")
+ {
+ var dict = new Dictionary();
+ dict["hypothesis_indices"] = hypothesis_indices;
+ dict["hypothesis_values"] = hypothesis_values;
+ dict["hypothesis_shape"] = hypothesis_shape;
+ dict["truth_indices"] = truth_indices;
+ dict["truth_values"] = truth_values;
+ dict["truth_shape"] = truth_shape;
+ if (normalize.HasValue)
+ dict["normalize"] = normalize.Value;
+ var op = _op_def_lib._apply_op_helper("EditDistance", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes exponential linear: exp(features) - 1 if < 0, features otherwise.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Elu'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// See [Fast and Accurate Deep Network Learning by Exponential Linear Units (ELUs)
+ /// ](http://arxiv.org/abs/1511.07289)
+ ///
+ public static Tensor elu (Tensor features, string name = "Elu")
+ {
+ var dict = new Dictionary();
+ dict["features"] = features;
+ var op = _op_def_lib._apply_op_helper("Elu", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes gradients for the exponential linear (Elu) operation.
+ ///
+ ///
+ /// The backpropagated gradients to the corresponding Elu operation.
+ ///
+ ///
+ /// The outputs of the corresponding Elu operation.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'EluGrad'.
+ ///
+ ///
+ /// The gradients: gradients * (outputs + 1) if outputs < 0,
+ /// gradients otherwise.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor elu_grad (Tensor gradients, Tensor outputs, string name = "EluGrad")
+ {
+ var dict = new Dictionary();
+ dict["gradients"] = gradients;
+ dict["outputs"] = outputs;
+ var op = _op_def_lib._apply_op_helper("EluGrad", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Creates a tensor with the given shape.
+ ///
+ /// This operation creates a tensor of shape and dtype.
+ ///
+ ///
+ /// 1-D. Represents the shape of the output tensor.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Empty'.
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// If True, initialize the returned tensor with the default value of dtype. Otherwise, the implementation is free not to initializethe tensor's content.
+ ///
+ ///
+ /// A Tensor of type T.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor empty (Tensor shape, TF_DataType dtype, bool? init = null, string name = "Empty")
+ {
+ var dict = new Dictionary();
+ dict["shape"] = shape;
+ dict["dtype"] = dtype;
+ if (init.HasValue)
+ dict["init"] = init.Value;
+ var op = _op_def_lib._apply_op_helper("Empty", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Creates and returns an empty tensor list.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'EmptyTensorList'.
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// All list elements must be tensors of dtype element_dtype and shape compatible
+ /// with element_shape.
+ ///
+ /// handle: an empty tensor list.
+ /// element_dtype: the type of elements in the list.
+ /// element_shape: a shape compatible with that of elements in the list.
+ ///
+ public static Tensor empty_tensor_list (Tensor element_shape, TF_DataType element_dtype, string name = "EmptyTensorList")
+ {
+ var dict = new Dictionary();
+ dict["element_shape"] = element_shape;
+ dict["element_dtype"] = element_dtype;
+ var op = _op_def_lib._apply_op_helper("EmptyTensorList", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Encode strings into web-safe base64 format.
+ ///
+ ///
+ /// Strings to be encoded.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'EncodeBase64'.
+ ///
+ ///
+ /// Bool whether padding is applied at the ends.
+ ///
+ ///
+ /// Input strings encoded in base64.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Refer to the following article for more information on base64 format:
+ /// en.wikipedia.org/wiki/Base64. Base64 strings may have padding with '=' at the
+ /// end so that the encoded has length multiple of 4. See Padding section of the
+ /// link above.
+ ///
+ /// Web-safe means that the encoder uses - and _ instead of + and /.
+ ///
+ public static Tensor encode_base64 (Tensor input, bool? pad = null, string name = "EncodeBase64")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ if (pad.HasValue)
+ dict["pad"] = pad.Value;
+ var op = _op_def_lib._apply_op_helper("EncodeBase64", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// JPEG-encode an image.
+ ///
+ ///
+ /// 3-D with shape [height, width, channels].
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'EncodeJpeg'.
+ ///
+ ///
+ /// Per pixel image format.
+ ///
+ ///
+ /// Quality of the compression from 0 to 100 (higher is better and slower).
+ ///
+ ///
+ /// If True, create a JPEG that loads progressively (coarse to fine).
+ ///
+ ///
+ /// If True, spend CPU/RAM to reduce size with no quality change.
+ ///
+ ///
+ /// See http://en.wikipedia.org/wiki/Chroma_subsampling.
+ ///
+ ///
+ /// Unit used to specify x_density and y_density:
+ /// pixels per inch ('in') or centimeter ('cm').
+ ///
+ ///
+ /// Horizontal pixels per density unit.
+ ///
+ ///
+ /// Vertical pixels per density unit.
+ ///
+ ///
+ /// If not empty, embed this XMP metadata in the image header.
+ ///
+ ///
+ /// 0-D. JPEG-encoded image.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// image is a 3-D uint8 Tensor of shape [height, width, channels].
+ ///
+ /// The attr format can be used to override the color format of the encoded
+ /// output. Values can be:
+ ///
+ /// * '': Use a default format based on the number of channels in the image.
+ /// * grayscale: Output a grayscale JPEG image. The channels dimension
+ /// of image must be 1.
+ /// * rgb: Output an RGB JPEG image. The channels dimension
+ /// of image must be 3.
+ ///
+ /// If format is not specified or is the empty string, a default format is picked
+ /// in function of the number of channels in image:
+ ///
+ /// * 1: Output a grayscale image.
+ /// * 3: Output an RGB image.
+ ///
+ public static Tensor encode_jpeg (Tensor image, string format = null, int? quality = null, bool? progressive = null, bool? optimize_size = null, bool? chroma_downsampling = null, string density_unit = null, int? x_density = null, int? y_density = null, string xmp_metadata = null, string name = "EncodeJpeg")
+ {
+ var dict = new Dictionary();
+ dict["image"] = image;
+ if (format != null)
+ dict["format"] = format;
+ if (quality.HasValue)
+ dict["quality"] = quality.Value;
+ if (progressive.HasValue)
+ dict["progressive"] = progressive.Value;
+ if (optimize_size.HasValue)
+ dict["optimize_size"] = optimize_size.Value;
+ if (chroma_downsampling.HasValue)
+ dict["chroma_downsampling"] = chroma_downsampling.Value;
+ if (density_unit != null)
+ dict["density_unit"] = density_unit;
+ if (x_density.HasValue)
+ dict["x_density"] = x_density.Value;
+ if (y_density.HasValue)
+ dict["y_density"] = y_density.Value;
+ if (xmp_metadata != null)
+ dict["xmp_metadata"] = xmp_metadata;
+ var op = _op_def_lib._apply_op_helper("EncodeJpeg", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// PNG-encode an image.
+ ///
+ ///
+ /// 3-D with shape [height, width, channels].
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'EncodePng'.
+ ///
+ ///
+ /// Compression level.
+ ///
+ ///
+ /// 0-D. PNG-encoded image.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// image is a 3-D uint8 or uint16 Tensor of shape [height, width, channels]
+ /// where channels is:
+ ///
+ /// * 1: for grayscale.
+ /// * 2: for grayscale + alpha.
+ /// * 3: for RGB.
+ /// * 4: for RGBA.
+ ///
+ /// The ZLIB compression level, compression, can be -1 for the PNG-encoder
+ /// default or a value from 0 to 9. 9 is the highest compression level, generating
+ /// the smallest output, but is slower.
+ ///
+ public static Tensor encode_png (Tensor image, int? compression = null, string name = "EncodePng")
+ {
+ var dict = new Dictionary();
+ dict["image"] = image;
+ if (compression.HasValue)
+ dict["compression"] = compression.Value;
+ var op = _op_def_lib._apply_op_helper("EncodePng", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// The op serializes protobuf messages provided in the input tensors.
+ ///
+ ///
+ /// Tensor of int32 with shape [batch_shape, len(field_names)].
+ ///
+ ///
+ /// List of tensors containing values for the corresponding field.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'EncodeProto'.
+ ///
+ ///
+ /// Optional argument
+ /// List of strings containing proto field names.
+ ///
+ ///
+ /// Optional argument
+ /// Name of the proto message type to decode.
+ ///
+ ///
+ ///
+ ///
+ /// Tensor of serialized protos with shape batch_shape.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// The types of the tensors in values must match the schema for the
+ /// fields specified in field_names. All the tensors in values must
+ /// have a common shape prefix, *batch_shape*.
+ ///
+ /// The sizes tensor specifies repeat counts for each field. The repeat
+ /// count (last dimension) of a each tensor in values must be greater
+ /// than or equal to corresponding repeat count in sizes.
+ ///
+ /// A message_type name must be provided to give context for the field
+ /// names. The actual message descriptor can be looked up either in the
+ /// linked-in descriptor pool or a filename provided by the caller using
+ /// the descriptor_source attribute.
+ ///
+ /// The descriptor_source attribute selects a source of protocol
+ /// descriptors to consult when looking up message_type. This may be a
+ /// filename containing a serialized FileDescriptorSet message,
+ /// or the special value local://, in which case only descriptors linked
+ /// into the code will be searched; the filename can be on any filesystem
+ /// accessible to TensorFlow.
+ ///
+ /// You can build a descriptor_source file using the --descriptor_set_out
+ /// and --include_imports options to the protocol compiler protoc.
+ ///
+ /// The local:// database only covers descriptors linked into the
+ /// code via C++ libraries, not Python imports. You can link in a proto descriptor
+ /// by creating a cc_library target with alwayslink=1.
+ ///
+ /// There are a few special cases in the value mapping:
+ ///
+ /// Submessage and group fields must be pre-serialized as TensorFlow strings.
+ ///
+ /// TensorFlow lacks support for unsigned int64s, so they must be
+ /// represented as tf.int64 with the same twos-complement bit pattern
+ /// (the obvious way).
+ ///
+ /// Unsigned int32 values can be represented exactly with tf.int64, or
+ /// with sign wrapping if the input is of type tf.int32.
+ ///
+ public static Tensor encode_proto (Tensor sizes, Tensor[] values, string[] field_names, string message_type, string descriptor_source = null, string name = "EncodeProto")
+ {
+ var dict = new Dictionary();
+ dict["sizes"] = sizes;
+ dict["values"] = values;
+ dict["field_names"] = field_names;
+ dict["message_type"] = message_type;
+ if (descriptor_source != null)
+ dict["descriptor_source"] = descriptor_source;
+ var op = _op_def_lib._apply_op_helper("EncodeProto", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Encode audio data using the WAV file format.
+ ///
+ ///
+ /// 2-D with shape [length, channels].
+ ///
+ ///
+ /// Scalar containing the sample frequency.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'EncodeWav'.
+ ///
+ ///
+ /// 0-D. WAV-encoded file contents.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// This operation will generate a string suitable to be saved out to create a .wav
+ /// audio file. It will be encoded in the 16-bit PCM format. It takes in float
+ /// values in the range -1.0f to 1.0f, and any outside that value will be clamped to
+ /// that range.
+ ///
+ /// audio is a 2-D float Tensor of shape [length, channels].
+ /// sample_rate is a scalar Tensor holding the rate to use (e.g. 44100).
+ ///
+ public static Tensor encode_wav (Tensor audio, Tensor sample_rate, string name = "EncodeWav")
+ {
+ var dict = new Dictionary();
+ dict["audio"] = audio;
+ dict["sample_rate"] = sample_rate;
+ var op = _op_def_lib._apply_op_helper("EncodeWav", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Ensures that the tensor's shape matches the expected shape.
+ ///
+ ///
+ /// A tensor, whose shape is to be validated.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'EnsureShape'.
+ ///
+ ///
+ /// Optional argument
+ /// The expected (possibly partially specified) shape of the input tensor.
+ ///
+ ///
+ /// A tensor with the same shape and contents as the input tensor or value.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Raises an error if the input tensor's shape does not match the specified shape.
+ /// Returns the input tensor otherwise.
+ ///
+ public static Tensor ensure_shape (Tensor input, TensorShape shape, string name = "EnsureShape")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["shape"] = shape;
+ var op = _op_def_lib._apply_op_helper("EnsureShape", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Creates or finds a child frame, and makes data available to the child frame.
+ ///
+ ///
+ /// The tensor to be made available to the child frame.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Enter'.
+ ///
+ ///
+ /// Optional argument
+ /// The name of the child frame.
+ ///
+ ///
+ /// If true, the output is constant within the child frame.
+ ///
+ ///
+ /// The number of iterations allowed to run in parallel.
+ ///
+ ///
+ /// The same tensor as data.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// This op is used together with Exit to create loops in the graph.
+ /// The unique frame_name is used by the Executor to identify frames. If
+ /// is_constant is true, output is a constant in the child frame; otherwise
+ /// it may be changed in the child frame. At most parallel_iterations iterations
+ /// are run in parallel in the child frame.
+ ///
+ public static Tensor enter (Tensor data, string frame_name, bool? is_constant = null, int? parallel_iterations = null, string name = "Enter")
+ {
+ var dict = new Dictionary();
+ dict["data"] = data;
+ dict["frame_name"] = frame_name;
+ if (is_constant.HasValue)
+ dict["is_constant"] = is_constant.Value;
+ if (parallel_iterations.HasValue)
+ dict["parallel_iterations"] = parallel_iterations.Value;
+ var op = _op_def_lib._apply_op_helper("Enter", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Returns the truth value of (x == y) element-wise.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Equal'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// *NOTE*: Equal supports broadcasting. More about broadcasting
+ /// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html)
+ ///
+ public static Tensor equal (Tensor x, Tensor y, string name = "Equal")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ dict["y"] = y;
+ var op = _op_def_lib._apply_op_helper("Equal", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes the Gauss error function of x element-wise.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Erf'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor erf (Tensor x, string name = "Erf")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ var op = _op_def_lib._apply_op_helper("Erf", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes the complementary error function of x element-wise.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Erfc'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor erfc (Tensor x, string name = "Erfc")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ var op = _op_def_lib._apply_op_helper("Erfc", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Exits the current frame to its parent frame.
+ ///
+ ///
+ /// The tensor to be made available to the parent frame.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Exit'.
+ ///
+ ///
+ /// The same tensor as data.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Exit makes its input data available to the parent frame.
+ ///
+ public static Tensor exit (Tensor data, string name = "Exit")
+ {
+ var dict = new Dictionary();
+ dict["data"] = data;
+ var op = _op_def_lib._apply_op_helper("Exit", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes exponential of x element-wise. \\(y = e^x\\).
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Exp'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor exp (Tensor x, string name = "Exp")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ var op = _op_def_lib._apply_op_helper("Exp", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Inserts a dimension of 1 into a tensor's shape.
+ ///
+ ///
+ ///
+ ///
+ /// 0-D (scalar). Specifies the dimension index at which to
+ /// expand the shape of input. Must be in the range
+ /// [-rank(input) - 1, rank(input)].
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ExpandDims'.
+ ///
+ ///
+ /// Contains the same data as input, but its shape has an additional
+ /// dimension of size 1 added.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Given a tensor input, this operation inserts a dimension of 1 at the
+ /// dimension index axis of input's shape. The dimension index axis starts at
+ /// zero; if you specify a negative number for axis it is counted backward from
+ /// the end.
+ ///
+ /// This operation is useful if you want to add a batch dimension to a single
+ /// element. For example, if you have a single image of shape [height, width,
+ /// channels], you can make it a batch of 1 image with expand_dims(image, 0),
+ /// which will make the shape [1, height, width, channels].
+ ///
+ /// Other examples:
+ ///
+ ///
+ /// # 't' is a tensor of shape [2]
+ /// shape(expand_dims(t, 0)) ==> [1, 2]
+ /// shape(expand_dims(t, 1)) ==> [2, 1]
+ /// shape(expand_dims(t, -1)) ==> [2, 1]
+ ///
+ /// # 't2' is a tensor of shape [2, 3, 5]
+ /// shape(expand_dims(t2, 0)) ==> [1, 2, 3, 5]
+ /// shape(expand_dims(t2, 2)) ==> [2, 3, 1, 5]
+ /// shape(expand_dims(t2, 3)) ==> [2, 3, 5, 1]
+ ///
+ ///
+ /// This operation requires that:
+ ///
+ /// -1-input.dims() <= dim <= input.dims()
+ ///
+ /// This operation is related to squeeze(), which removes dimensions of
+ /// size 1.
+ ///
+ public static Tensor expand_dims (Tensor input, Tensor dim, string name = "ExpandDims")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["dim"] = dim;
+ var op = _op_def_lib._apply_op_helper("ExpandDims", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Computes exponential of x - 1 element-wise.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Expm1'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// I.e., \\(y = (\exp x) - 1\\).
+ ///
+ public static Tensor expm1 (Tensor x, string name = "Expm1")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ var op = _op_def_lib._apply_op_helper("Expm1", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Extracts a glimpse from the input tensor.
+ ///
+ ///
+ /// A 4-D float tensor of shape [batch_size, height, width, channels].
+ ///
+ ///
+ /// A 1-D tensor of 2 elements containing the size of the glimpses
+ /// to extract. The glimpse height must be specified first, following
+ /// by the glimpse width.
+ ///
+ ///
+ /// A 2-D integer tensor of shape [batch_size, 2] containing
+ /// the y, x locations of the center of each window.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ExtractGlimpse'.
+ ///
+ ///
+ /// indicates if the offset coordinates are centered relative to
+ /// the image, in which case the (0, 0) offset is relative to the center
+ /// of the input images. If false, the (0,0) offset corresponds to the
+ /// upper left corner of the input images.
+ ///
+ ///
+ /// indicates if the offset coordinates are normalized.
+ ///
+ ///
+ /// indicates if the noise should be generated using a
+ /// uniform distribution or a Gaussian distribution.
+ ///
+ ///
+ /// A tensor representing the glimpses [batch_size,
+ /// glimpse_height, glimpse_width, channels].
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Returns a set of windows called glimpses extracted at location
+ /// offsets from the input tensor. If the windows only partially
+ /// overlaps the inputs, the non overlapping areas will be filled with
+ /// random noise.
+ ///
+ /// The result is a 4-D tensor of shape [batch_size, glimpse_height,
+ /// glimpse_width, channels]. The channels and batch dimensions are the
+ /// same as that of the input tensor. The height and width of the output
+ /// windows are specified in the size parameter.
+ ///
+ /// The argument normalized and centered controls how the windows are built:
+ ///
+ /// * If the coordinates are normalized but not centered, 0.0 and 1.0
+ /// correspond to the minimum and maximum of each height and width
+ /// dimension.
+ /// * If the coordinates are both normalized and centered, they range from
+ /// -1.0 to 1.0. The coordinates (-1.0, -1.0) correspond to the upper
+ /// left corner, the lower right corner is located at (1.0, 1.0) and the
+ /// center is at (0, 0).
+ /// * If the coordinates are not normalized they are interpreted as
+ /// numbers of pixels.
+ ///
+ public static Tensor extract_glimpse (Tensor input, Tensor size, Tensor offsets, bool? centered = null, bool? normalized = null, bool? uniform_noise = null, string name = "ExtractGlimpse")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ dict["size"] = size;
+ dict["offsets"] = offsets;
+ if (centered.HasValue)
+ dict["centered"] = centered.Value;
+ if (normalized.HasValue)
+ dict["normalized"] = normalized.Value;
+ if (uniform_noise.HasValue)
+ dict["uniform_noise"] = uniform_noise.Value;
+ var op = _op_def_lib._apply_op_helper("ExtractGlimpse", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Extract patches from images and put them in the "depth" output dimension.
+ ///
+ ///
+ /// 4-D Tensor with shape [batch, in_rows, in_cols, depth].
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ExtractImagePatches'.
+ ///
+ ///
+ /// Optional argument
+ /// The size of the sliding window for each dimension of images.
+ ///
+ ///
+ /// Optional argument
+ /// 1-D of length 4. How far the centers of two consecutive patches are in
+ /// the images. Must be: [1, stride_rows, stride_cols, 1].
+ ///
+ ///
+ /// Optional argument
+ /// 1-D of length 4. Must be: [1, rate_rows, rate_cols, 1]. This is the
+ /// input stride, specifying how far two consecutive patch samples are in the
+ /// input. Equivalent to extracting patches with
+ /// patch_sizes_eff = patch_sizes + (patch_sizes - 1) * (rates - 1), followed by
+ /// subsampling them spatially by a factor of rates. This is equivalent to
+ /// rate in dilated (a.k.a. Atrous) convolutions.
+ ///
+ ///
+ /// Optional argument
+ /// The type of padding algorithm to use.
+ ///
+ /// We specify the size-related attributes as:
+ ///
+ ///
+ /// ksizes = [1, ksize_rows, ksize_cols, 1]
+ /// strides = [1, strides_rows, strides_cols, 1]
+ /// rates = [1, rates_rows, rates_cols, 1]
+ ///
+ ///
+ ///
+ /// 4-D Tensor with shape [batch, out_rows, out_cols, ksize_rows *
+ /// ksize_cols * depth] containing image patches with size
+ /// ksize_rows x ksize_cols x depth vectorized in the "depth" dimension. Note
+ /// out_rows and out_cols are the dimensions of the output patches.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor extract_image_patches (Tensor images, int[] ksizes, int[] strides, int[] rates, string padding, string name = "ExtractImagePatches")
+ {
+ var dict = new Dictionary();
+ dict["images"] = images;
+ dict["ksizes"] = ksizes;
+ dict["strides"] = strides;
+ dict["rates"] = rates;
+ dict["padding"] = padding;
+ var op = _op_def_lib._apply_op_helper("ExtractImagePatches", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Extract the shape information of a JPEG-encoded image.
+ ///
+ ///
+ /// 0-D. The JPEG-encoded image.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ExtractJpegShape'.
+ ///
+ ///
+ /// (Optional) The output type of the operation (int32 or int64).
+ /// Defaults to int32.
+ ///
+ ///
+ /// 1-D. The image shape with format [height, width, channels].
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// This op only parses the image header, so it is much faster than DecodeJpeg.
+ ///
+ public static Tensor extract_jpeg_shape (Tensor contents, TF_DataType? output_type = null, string name = "ExtractJpegShape")
+ {
+ var dict = new Dictionary();
+ dict["contents"] = contents;
+ if (output_type.HasValue)
+ dict["output_type"] = output_type.Value;
+ var op = _op_def_lib._apply_op_helper("ExtractJpegShape", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Fast Fourier transform.
+ ///
+ ///
+ /// A complex64 tensor.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'FFT'.
+ ///
+ ///
+ /// A complex64 tensor of the same shape as input. The inner-most
+ /// dimension of input is replaced with its 1D Fourier transform.
+ ///
+ /// @compatibility(numpy)
+ /// Equivalent to np.fft.fft
+ /// @end_compatibility
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Computes the 1-dimensional discrete Fourier transform over the inner-most
+ /// dimension of input.
+ ///
+ public static Tensor f_f_t (Tensor input, string name = "FFT")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ var op = _op_def_lib._apply_op_helper("FFT", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// 2D fast Fourier transform.
+ ///
+ ///
+ /// A complex64 tensor.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'FFT2D'.
+ ///
+ ///
+ /// A complex64 tensor of the same shape as input. The inner-most 2
+ /// dimensions of input are replaced with their 2D Fourier transform.
+ ///
+ /// @compatibility(numpy)
+ /// Equivalent to np.fft.fft2
+ /// @end_compatibility
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Computes the 2-dimensional discrete Fourier transform over the inner-most
+ /// 2 dimensions of input.
+ ///
+ public static Tensor f_f_t2d (Tensor input, string name = "FFT2D")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ var op = _op_def_lib._apply_op_helper("FFT2D", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// 3D fast Fourier transform.
+ ///
+ ///
+ /// A complex64 tensor.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'FFT3D'.
+ ///
+ ///
+ /// A complex64 tensor of the same shape as input. The inner-most 3
+ /// dimensions of input are replaced with their 3D Fourier transform.
+ ///
+ /// @compatibility(numpy)
+ /// Equivalent to np.fft.fftn with 3 dimensions.
+ /// @end_compatibility
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Computes the 3-dimensional discrete Fourier transform over the inner-most 3
+ /// dimensions of input.
+ ///
+ public static Tensor f_f_t3d (Tensor input, string name = "FFT3D")
+ {
+ var dict = new Dictionary();
+ dict["input"] = input;
+ var op = _op_def_lib._apply_op_helper("FFT3D", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// A queue that produces elements in first-in first-out order.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'FIFOQueue'.
+ ///
+ ///
+ /// Optional argument
+ /// The type of each component in a value.
+ ///
+ ///
+ /// The shape of each component in a value. The length of this attr must
+ /// be either 0 or the same as the length of component_types. If the length of
+ /// this attr is 0, the shapes of queue elements are not constrained, and
+ /// only one element may be dequeued at a time.
+ ///
+ ///
+ /// The upper bound on the number of elements in this queue.
+ /// Negative numbers mean no limit.
+ ///
+ ///
+ /// If non-empty, this queue is placed in the given container.
+ /// Otherwise, a default container is used.
+ ///
+ ///
+ /// If non-empty, this queue will be shared under the given name
+ /// across multiple sessions.
+ ///
+ ///
+ /// The handle to the queue.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor f_i_f_o_queue (TF_DataType[] component_types, TensorShape[] shapes = null, int? capacity = null, string container = null, string shared_name = null, string name = "FIFOQueue")
+ {
+ var dict = new Dictionary();
+ dict["component_types"] = component_types;
+ if (shapes != null)
+ dict["shapes"] = shapes;
+ if (capacity.HasValue)
+ dict["capacity"] = capacity.Value;
+ if (container != null)
+ dict["container"] = container;
+ if (shared_name != null)
+ dict["shared_name"] = shared_name;
+ var op = _op_def_lib._apply_op_helper("FIFOQueue", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// A queue that produces elements in first-in first-out order.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'FIFOQueueV2'.
+ ///
+ ///
+ /// Optional argument
+ /// The type of each component in a value.
+ ///
+ ///
+ /// The shape of each component in a value. The length of this attr must
+ /// be either 0 or the same as the length of component_types. If the length of
+ /// this attr is 0, the shapes of queue elements are not constrained, and
+ /// only one element may be dequeued at a time.
+ ///
+ ///
+ /// The upper bound on the number of elements in this queue.
+ /// Negative numbers mean no limit.
+ ///
+ ///
+ /// If non-empty, this queue is placed in the given container.
+ /// Otherwise, a default container is used.
+ ///
+ ///
+ /// If non-empty, this queue will be shared under the given name
+ /// across multiple sessions.
+ ///
+ ///
+ /// The handle to the queue.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor f_i_f_o_queue_v2 (TF_DataType[] component_types, TensorShape[] shapes = null, int? capacity = null, string container = null, string shared_name = null, string name = "FIFOQueueV2")
+ {
+ var dict = new Dictionary();
+ dict["component_types"] = component_types;
+ if (shapes != null)
+ dict["shapes"] = shapes;
+ if (capacity.HasValue)
+ dict["capacity"] = capacity.Value;
+ if (container != null)
+ dict["container"] = container;
+ if (shared_name != null)
+ dict["shared_name"] = shared_name;
+ var op = _op_def_lib._apply_op_helper("FIFOQueueV2", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// This op is used as a placeholder in If branch functions. It doesn't provide a
+ /// valid output when run, so must either be removed (e.g. replaced with a
+ /// function input) or guaranteed not to be used (e.g. if mirroring an
+ /// intermediate output needed for the gradient computation of the other branch).
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'FakeParam'.
+ ///
+ ///
+ /// Optional argument
+ /// The type of the output.
+ ///
+ ///
+ /// Optional argument
+ /// The purported shape of the output. This is only used for shape inference;
+ /// the output will not necessarily have this shape. Can be a partial shape.
+ ///
+ ///
+ /// \"Fake\" output value. This should not be consumed by another op.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor fake_param (TF_DataType dtype, TensorShape shape, string name = "FakeParam")
+ {
+ var dict = new Dictionary();
+ dict["dtype"] = dtype;
+ dict["shape"] = shape;
+ var op = _op_def_lib._apply_op_helper("FakeParam", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Fake-quantize the 'inputs' tensor, type float to 'outputs' tensor of same type.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'FakeQuantWithMinMaxArgs'.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// Attributes [min; max] define the clamping range for the inputs data.
+ /// inputs values are quantized into the quantization range ([0; 2^num_bits - 1]
+ /// when narrow_range is false and [1; 2^num_bits - 1] when it is true) and
+ /// then de-quantized and output as floats in [min; max] interval.
+ /// num_bits is the bitwidth of the quantization; between 2 and 16, inclusive.
+ ///
+ /// Quantization is called fake since the output is still in floating point.
+ ///
+ public static Tensor fake_quant_with_min_max_args (Tensor inputs, float? min = null, float? max = null, int? num_bits = null, bool? narrow_range = null, string name = "FakeQuantWithMinMaxArgs")
+ {
+ var dict = new Dictionary();
+ dict["inputs"] = inputs;
+ if (min.HasValue)
+ dict["min"] = min.Value;
+ if (max.HasValue)
+ dict["max"] = max.Value;
+ if (num_bits.HasValue)
+ dict["num_bits"] = num_bits.Value;
+ if (narrow_range.HasValue)
+ dict["narrow_range"] = narrow_range.Value;
+ var op = _op_def_lib._apply_op_helper("FakeQuantWithMinMaxArgs", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Compute gradients for a FakeQuantWithMinMaxArgs operation.
+ ///
+ ///
+ /// Backpropagated gradients above the FakeQuantWithMinMaxArgs operation.
+ ///
+ ///
+ /// Values passed as inputs to the FakeQuantWithMinMaxArgs operation.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'FakeQuantWithMinMaxArgsGradient'.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Backpropagated gradients below the FakeQuantWithMinMaxArgs operation:
+ /// gradients * (inputs >= min && inputs <= max).
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor fake_quant_with_min_max_args_gradient (Tensor gradients, Tensor inputs, float? min = null, float? max = null, int? num_bits = null, bool? narrow_range = null, string name = "FakeQuantWithMinMaxArgsGradient")
+ {
+ var dict = new Dictionary();
+ dict["gradients"] = gradients;
+ dict["inputs"] = inputs;
+ if (min.HasValue)
+ dict["min"] = min.Value;
+ if (max.HasValue)
+ dict["max"] = max.Value;
+ if (num_bits.HasValue)
+ dict["num_bits"] = num_bits.Value;
+ if (narrow_range.HasValue)
+ dict["narrow_range"] = narrow_range.Value;
+ var op = _op_def_lib._apply_op_helper("FakeQuantWithMinMaxArgsGradient", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Fake-quantize the 'inputs' tensor of type float via global float scalars min
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'FakeQuantWithMinMaxVars'.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// and max to 'outputs' tensor of same shape as inputs.
+ ///
+ /// [min; max] define the clamping range for the inputs data.
+ /// inputs values are quantized into the quantization range ([0; 2^num_bits - 1]
+ /// when narrow_range is false and [1; 2^num_bits - 1] when it is true) and
+ /// then de-quantized and output as floats in [min; max] interval.
+ /// num_bits is the bitwidth of the quantization; between 2 and 16, inclusive.
+ ///
+ /// This operation has a gradient and thus allows for training min and max
+ /// values.
+ ///
+ public static Tensor fake_quant_with_min_max_vars (Tensor inputs, Tensor min, Tensor max, int? num_bits = null, bool? narrow_range = null, string name = "FakeQuantWithMinMaxVars")
+ {
+ var dict = new Dictionary();
+ dict["inputs"] = inputs;
+ dict["min"] = min;
+ dict["max"] = max;
+ if (num_bits.HasValue)
+ dict["num_bits"] = num_bits.Value;
+ if (narrow_range.HasValue)
+ dict["narrow_range"] = narrow_range.Value;
+ var op = _op_def_lib._apply_op_helper("FakeQuantWithMinMaxVars", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Compute gradients for a FakeQuantWithMinMaxVars operation.
+ ///
+ ///
+ /// Backpropagated gradients above the FakeQuantWithMinMaxVars operation.
+ ///
+ ///
+ /// Values passed as inputs to the FakeQuantWithMinMaxVars operation.
+ /// min, max: Quantization interval, scalar floats.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'FakeQuantWithMinMaxVarsGradient'.
+ ///
+ ///
+ /// The bitwidth of the quantization; between 2 and 8, inclusive.
+ ///
+ ///
+ /// Whether to quantize into 2^num_bits - 1 distinct values.
+ ///
+ ///
+ /// Returns a tuple with multiple values, as follows:
+ /// backprops_wrt_input : Backpropagated gradients w.r.t. inputs:
+ /// gradients * (inputs >= min && inputs <= max).
+ /// backprop_wrt_min : Backpropagated gradients w.r.t. min parameter:
+ /// sum(gradients * (inputs < min)).
+ /// backprop_wrt_max : Backpropagated gradients w.r.t. max parameter:
+ /// sum(gradients * (inputs > max)).
+ /// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
+ ///
+ public static (Tensor backprops_wrt_input, Tensor backprop_wrt_min, Tensor backprop_wrt_max) fake_quant_with_min_max_vars_gradient (Tensor gradients, Tensor inputs, Tensor min, Tensor max, int? num_bits = null, bool? narrow_range = null, string name = "FakeQuantWithMinMaxVarsGradient")
+ {
+ var dict = new Dictionary();
+ dict["gradients"] = gradients;
+ dict["inputs"] = inputs;
+ dict["min"] = min;
+ dict["max"] = max;
+ if (num_bits.HasValue)
+ dict["num_bits"] = num_bits.Value;
+ if (narrow_range.HasValue)
+ dict["narrow_range"] = narrow_range.Value;
+ var op = _op_def_lib._apply_op_helper("FakeQuantWithMinMaxVarsGradient", name: name, keywords: dict);
+ int _idx = 0;
+ var backprops_wrt_input = op.outputs[_idx++];
+ var backprop_wrt_min = op.outputs[_idx++];
+ var backprop_wrt_max = op.outputs[_idx++];
+ return (backprops_wrt_input, backprop_wrt_min, backprop_wrt_max);
+ }
+
+ ///
+ /// Fake-quantize the 'inputs' tensor of type float and one of the shapes: [d],
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'FakeQuantWithMinMaxVarsPerChannel'.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// [b, d] [b, h, w, d] via per-channel floats min and max of shape [d]
+ /// to 'outputs' tensor of same shape as inputs.
+ ///
+ /// [min; max] define the clamping range for the inputs data.
+ /// inputs values are quantized into the quantization range ([0; 2^num_bits - 1]
+ /// when narrow_range is false and [1; 2^num_bits - 1] when it is true) and
+ /// then de-quantized and output as floats in [min; max] interval.
+ /// num_bits is the bitwidth of the quantization; between 2 and 16, inclusive.
+ ///
+ /// This operation has a gradient and thus allows for training min and max
+ /// values.
+ ///
+ public static Tensor fake_quant_with_min_max_vars_per_channel (Tensor inputs, Tensor min, Tensor max, int? num_bits = null, bool? narrow_range = null, string name = "FakeQuantWithMinMaxVarsPerChannel")
+ {
+ var dict = new Dictionary();
+ dict["inputs"] = inputs;
+ dict["min"] = min;
+ dict["max"] = max;
+ if (num_bits.HasValue)
+ dict["num_bits"] = num_bits.Value;
+ if (narrow_range.HasValue)
+ dict["narrow_range"] = narrow_range.Value;
+ var op = _op_def_lib._apply_op_helper("FakeQuantWithMinMaxVarsPerChannel", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Compute gradients for a FakeQuantWithMinMaxVarsPerChannel operation.
+ ///
+ ///
+ /// Backpropagated gradients above the FakeQuantWithMinMaxVars operation,
+ /// shape one of: [d], [b, d], [b, h, w, d].
+ ///
+ ///
+ /// Values passed as inputs to the FakeQuantWithMinMaxVars operation, shape
+ /// same as gradients.
+ /// min, max: Quantization interval, floats of shape [d].
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'FakeQuantWithMinMaxVarsPerChannelGradient'.
+ ///
+ ///
+ /// The bitwidth of the quantization; between 2 and 16, inclusive.
+ ///
+ ///
+ /// Whether to quantize into 2^num_bits - 1 distinct values.
+ ///
+ ///
+ /// Returns a tuple with multiple values, as follows:
+ /// backprops_wrt_input : Backpropagated gradients w.r.t. inputs, shape same as
+ /// inputs:
+ /// gradients * (inputs >= min && inputs <= max).
+ /// backprop_wrt_min : Backpropagated gradients w.r.t. min parameter, shape [d]:
+ /// sum_per_d(gradients * (inputs < min)).
+ /// backprop_wrt_max : Backpropagated gradients w.r.t. max parameter, shape [d]:
+ /// sum_per_d(gradients * (inputs > max)).
+ /// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
+ ///
+ public static (Tensor backprops_wrt_input, Tensor backprop_wrt_min, Tensor backprop_wrt_max) fake_quant_with_min_max_vars_per_channel_gradient (Tensor gradients, Tensor inputs, Tensor min, Tensor max, int? num_bits = null, bool? narrow_range = null, string name = "FakeQuantWithMinMaxVarsPerChannelGradient")
+ {
+ var dict = new Dictionary();
+ dict["gradients"] = gradients;
+ dict["inputs"] = inputs;
+ dict["min"] = min;
+ dict["max"] = max;
+ if (num_bits.HasValue)
+ dict["num_bits"] = num_bits.Value;
+ if (narrow_range.HasValue)
+ dict["narrow_range"] = narrow_range.Value;
+ var op = _op_def_lib._apply_op_helper("FakeQuantWithMinMaxVarsPerChannelGradient", name: name, keywords: dict);
+ int _idx = 0;
+ var backprops_wrt_input = op.outputs[_idx++];
+ var backprop_wrt_min = op.outputs[_idx++];
+ var backprop_wrt_max = op.outputs[_idx++];
+ return (backprops_wrt_input, backprop_wrt_min, backprop_wrt_max);
+ }
+
+ ///
+ /// Deprecated. Do not use.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'FakeQueue'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor fake_queue (Tensor resource, string name = "FakeQueue")
+ {
+ var dict = new Dictionary();
+ dict["resource"] = resource;
+ var op = _op_def_lib._apply_op_helper("FakeQueue", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Creates a tensor filled with a scalar value.
+ ///
+ ///
+ /// 1-D. Represents the shape of the output tensor.
+ ///
+ ///
+ /// 0-D (scalar). Value to fill the returned tensor.
+ ///
+ /// @compatibility(numpy)
+ /// Equivalent to np.full
+ /// @end_compatibility
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Fill'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// This operation creates a tensor of shape dims and fills it with value.
+ ///
+ /// For example:
+ ///
+ ///
+ /// # Output tensor has shape [2, 3].
+ /// fill([2, 3], 9) ==> [[9, 9, 9]
+ /// [9, 9, 9]]
+ ///
+ ///
+ /// tf.fill differs from tf.constant in a few ways:
+ ///
+ /// * tf.fill only supports scalar contents, whereas tf.constant supports
+ /// Tensor values.
+ /// * tf.fill creates an Op in the computation graph that constructs the actual
+ /// Tensor value at runtime. This is in contrast to tf.constant which embeds
+ /// the entire Tensor into the graph with a Const node.
+ /// * Because tf.fill evaluates at graph runtime, it supports dynamic shapes
+ /// based on other runtime Tensors, unlike tf.constant.
+ ///
+ public static Tensor fill (Tensor dims, Tensor value, string name = "Fill")
+ {
+ var dict = new Dictionary();
+ dict["dims"] = dims;
+ dict["value"] = value;
+ var op = _op_def_lib._apply_op_helper("Fill", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Creates a dataset containing elements of first component of input_dataset having true in the last component.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'FilterByLastComponentDataset'.
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// Optional argument
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor filter_by_last_component_dataset (Tensor input_dataset, TF_DataType[] output_types, TensorShape[] output_shapes, string name = "FilterByLastComponentDataset")
+ {
+ var dict = new Dictionary();
+ dict["input_dataset"] = input_dataset;
+ dict["output_types"] = output_types;
+ dict["output_shapes"] = output_shapes;
+ var op = _op_def_lib._apply_op_helper("FilterByLastComponentDataset", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Creates a dataset that emits the records from one or more binary files.
+ ///
+ ///
+ /// A scalar or a vector containing the name(s) of the file(s) to be
+ /// read.
+ ///
+ ///
+ /// A scalar representing the number of bytes to skip at the
+ /// beginning of a file.
+ ///
+ ///
+ /// A scalar representing the number of bytes in each record.
+ ///
+ ///
+ /// A scalar representing the number of bytes to skip at the end
+ /// of a file.
+ ///
+ ///
+ /// A scalar representing the number of bytes to buffer. Must be > 0.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'FixedLengthRecordDataset'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor fixed_length_record_dataset (Tensor filenames, Tensor header_bytes, Tensor record_bytes, Tensor footer_bytes, Tensor buffer_size, string name = "FixedLengthRecordDataset")
+ {
+ var dict = new Dictionary();
+ dict["filenames"] = filenames;
+ dict["header_bytes"] = header_bytes;
+ dict["record_bytes"] = record_bytes;
+ dict["footer_bytes"] = footer_bytes;
+ dict["buffer_size"] = buffer_size;
+ var op = _op_def_lib._apply_op_helper("FixedLengthRecordDataset", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// A Reader that outputs fixed-length records from a file.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'FixedLengthRecordReader'.
+ ///
+ ///
+ /// Optional argument
+ /// Number of bytes in the record.
+ ///
+ ///
+ /// Number of bytes in the header, defaults to 0.
+ ///
+ ///
+ /// Number of bytes in the footer, defaults to 0.
+ ///
+ ///
+ /// Number of bytes to hop before each read. Default of 0 means using
+ /// record_bytes.
+ ///
+ ///
+ /// If non-empty, this reader is placed in the given container.
+ /// Otherwise, a default container is used.
+ ///
+ ///
+ /// If non-empty, this reader is named in the given bucket
+ /// with this shared_name. Otherwise, the node name is used instead.
+ ///
+ ///
+ /// The handle to reference the Reader.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor fixed_length_record_reader (int record_bytes, int? header_bytes = null, int? footer_bytes = null, int? hop_bytes = null, string container = null, string shared_name = null, string name = "FixedLengthRecordReader")
+ {
+ var dict = new Dictionary();
+ dict["record_bytes"] = record_bytes;
+ if (header_bytes.HasValue)
+ dict["header_bytes"] = header_bytes.Value;
+ if (footer_bytes.HasValue)
+ dict["footer_bytes"] = footer_bytes.Value;
+ if (hop_bytes.HasValue)
+ dict["hop_bytes"] = hop_bytes.Value;
+ if (container != null)
+ dict["container"] = container;
+ if (shared_name != null)
+ dict["shared_name"] = shared_name;
+ var op = _op_def_lib._apply_op_helper("FixedLengthRecordReader", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// A Reader that outputs fixed-length records from a file.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'FixedLengthRecordReaderV2'.
+ ///
+ ///
+ /// Optional argument
+ /// Number of bytes in the record.
+ ///
+ ///
+ /// Number of bytes in the header, defaults to 0.
+ ///
+ ///
+ /// Number of bytes in the footer, defaults to 0.
+ ///
+ ///
+ /// Number of bytes to hop before each read. Default of 0 means using
+ /// record_bytes.
+ ///
+ ///
+ /// If non-empty, this reader is placed in the given container.
+ /// Otherwise, a default container is used.
+ ///
+ ///
+ /// If non-empty, this reader is named in the given bucket
+ /// with this shared_name. Otherwise, the node name is used instead.
+ ///
+ ///
+ /// The type of encoding for the file. Currently ZLIB and GZIP
+ /// are supported. Defaults to none.
+ ///
+ ///
+ /// The handle to reference the Reader.
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor fixed_length_record_reader_v2 (int record_bytes, int? header_bytes = null, int? footer_bytes = null, int? hop_bytes = null, string container = null, string shared_name = null, string encoding = null, string name = "FixedLengthRecordReaderV2")
+ {
+ var dict = new Dictionary();
+ dict["record_bytes"] = record_bytes;
+ if (header_bytes.HasValue)
+ dict["header_bytes"] = header_bytes.Value;
+ if (footer_bytes.HasValue)
+ dict["footer_bytes"] = footer_bytes.Value;
+ if (hop_bytes.HasValue)
+ dict["hop_bytes"] = hop_bytes.Value;
+ if (container != null)
+ dict["container"] = container;
+ if (shared_name != null)
+ dict["shared_name"] = shared_name;
+ if (encoding != null)
+ dict["encoding"] = encoding;
+ var op = _op_def_lib._apply_op_helper("FixedLengthRecordReaderV2", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Generates labels for candidate sampling with a learned unigram distribution.
+ ///
+ ///
+ /// A batch_size * num_true matrix, in which each row contains the
+ /// IDs of the num_true target_classes in the corresponding original label.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'FixedUnigramCandidateSampler'.
+ ///
+ ///
+ /// Optional argument
+ /// Number of true labels per context.
+ ///
+ ///
+ /// Optional argument
+ /// Number of candidates to randomly sample.
+ ///
+ ///
+ /// Optional argument
+ /// If unique is true, we sample with rejection, so that all sampled
+ /// candidates in a batch are unique. This requires some approximation to
+ /// estimate the post-rejection sampling probabilities.
+ ///
+ ///
+ /// Optional argument
+ /// The sampler will sample integers from the interval [0, range_max).
+ ///
+ ///
+ /// Each valid line in this file (which should have a CSV-like format)
+ /// corresponds to a valid word ID. IDs are in sequential order, starting from
+ /// num_reserved_ids. The last entry in each line is expected to be a value
+ /// corresponding to the count or relative probability. Exactly one of vocab_file
+ /// and unigrams needs to be passed to this op.
+ ///
+ ///
+ /// The distortion is used to skew the unigram probability distribution.
+ /// Each weight is first raised to the distortion's power before adding to the
+ /// internal unigram distribution. As a result, distortion = 1.0 gives regular
+ /// unigram sampling (as defined by the vocab file), and distortion = 0.0 gives
+ /// a uniform distribution.
+ ///
+ ///
+ /// Optionally some reserved IDs can be added in the range [0,
+ /// ..., num_reserved_ids) by the users. One use case is that a special unknown
+ /// word token is used as ID 0. These IDs will have a sampling probability of 0.
+ ///
+ ///
+ /// A sampler can be used to sample from a subset of the original range
+ /// in order to speed up the whole computation through parallelism. This parameter
+ /// (together with 'shard') indicates the number of partitions that are being
+ /// used in the overall computation.
+ ///
+ ///
+ /// A sampler can be used to sample from a subset of the original range
+ /// in order to speed up the whole computation through parallelism. This parameter
+ /// (together with 'num_shards') indicates the particular partition number of a
+ /// sampler op, when partitioning is being used.
+ ///
+ ///
+ /// A list of unigram counts or probabilities, one per ID in sequential
+ /// order. Exactly one of vocab_file and unigrams should be passed to this op.
+ ///
+ ///
+ /// If either seed or seed2 are set to be non-zero, the random number
+ /// generator is seeded by the given seed. Otherwise, it is seeded by a
+ /// random seed.
+ ///
+ ///
+ /// An second seed to avoid seed collision.
+ ///
+ ///
+ /// Returns a tuple with multiple values, as follows:
+ /// sampled_candidates : A vector of length num_sampled, in which each element is
+ /// the ID of a sampled candidate.
+ /// true_expected_count : A batch_size * num_true matrix, representing
+ /// the number of times each candidate is expected to occur in a batch
+ /// of sampled candidates. If unique=true, then this is a probability.
+ /// sampled_expected_count : A vector of length num_sampled, for each sampled
+ /// candidate representing the number of times the candidate is expected
+ /// to occur in a batch of sampled candidates. If unique=true, then this is a
+ /// probability.
+ /// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
+ ///
+ ///
+ /// A unigram sampler could use a fixed unigram distribution read from a
+ /// file or passed in as an in-memory array instead of building up the distribution
+ /// from data on the fly. There is also an option to skew the distribution by
+ /// applying a distortion power to the weights.
+ ///
+ /// The vocabulary file should be in CSV-like format, with the last field
+ /// being the weight associated with the word.
+ ///
+ /// For each batch, this op picks a single set of sampled candidate labels.
+ ///
+ /// The advantages of sampling candidates per-batch are simplicity and the
+ /// possibility of efficient dense matrix multiplication. The disadvantage is that
+ /// the sampled candidates must be chosen independently of the context and of the
+ /// true labels.
+ ///
+ public static (Tensor sampled_candidates, Tensor true_expected_count, Tensor sampled_expected_count) fixed_unigram_candidate_sampler (Tensor true_classes, int num_true, int num_sampled, bool unique, int range_max, string vocab_file = null, float? distortion = null, int? num_reserved_ids = null, int? num_shards = null, int? shard = null, float[] unigrams = null, int? seed = null, int? seed2 = null, string name = "FixedUnigramCandidateSampler")
+ {
+ var dict = new Dictionary();
+ dict["true_classes"] = true_classes;
+ dict["num_true"] = num_true;
+ dict["num_sampled"] = num_sampled;
+ dict["unique"] = unique;
+ dict["range_max"] = range_max;
+ if (vocab_file != null)
+ dict["vocab_file"] = vocab_file;
+ if (distortion.HasValue)
+ dict["distortion"] = distortion.Value;
+ if (num_reserved_ids.HasValue)
+ dict["num_reserved_ids"] = num_reserved_ids.Value;
+ if (num_shards.HasValue)
+ dict["num_shards"] = num_shards.Value;
+ if (shard.HasValue)
+ dict["shard"] = shard.Value;
+ if (unigrams != null)
+ dict["unigrams"] = unigrams;
+ if (seed.HasValue)
+ dict["seed"] = seed.Value;
+ if (seed2.HasValue)
+ dict["seed2"] = seed2.Value;
+ var op = _op_def_lib._apply_op_helper("FixedUnigramCandidateSampler", name: name, keywords: dict);
+ int _idx = 0;
+ var sampled_candidates = op.outputs[_idx++];
+ var true_expected_count = op.outputs[_idx++];
+ var sampled_expected_count = op.outputs[_idx++];
+ return (sampled_candidates, true_expected_count, sampled_expected_count);
+ }
+
+ ///
+ /// Returns element-wise largest integer not greater than x.
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Floor'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ public static Tensor floor (Tensor x, string name = "Floor")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ var op = _op_def_lib._apply_op_helper("Floor", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Returns x // y element-wise.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'FloorDiv'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// *NOTE*: FloorDiv supports broadcasting. More about broadcasting
+ /// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html)
+ ///
+ public static Tensor floor_div (Tensor x, Tensor y, string name = "FloorDiv")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ dict["y"] = y;
+ var op = _op_def_lib._apply_op_helper("FloorDiv", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Returns element-wise remainder of division. When x < 0 xor y < 0 is
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'FloorMod'.
+ ///
+ ///
+ /// The Operation can be fetched from the resulting Tensor, by fetching the Operation property from the result.
+ ///
+ ///
+ /// true, this follows Python semantics in that the result here is consistent
+ /// with a flooring divide. E.g. floor(x / y) * y + mod(x, y) = x.
+ ///
+ /// *NOTE*: FloorMod supports broadcasting. More about broadcasting
+ /// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html)
+ ///
+ public static Tensor floor_mod (Tensor x, Tensor y, string name = "FloorMod")
+ {
+ var dict = new Dictionary();
+ dict["x"] = x;
+ dict["y"] = y;
+ var op = _op_def_lib._apply_op_helper("FloorMod", name: name, keywords: dict);
+ return op.output;
+ }
+
+ ///
+ /// Performs fractional average pooling on the input.
+ ///
+ ///
+ /// 4-D with shape [batch, height, width, channels].
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'FractionalAvgPool'.
+ ///
+ ///
+ /// Optional argument
+ /// Pooling ratio for each dimension of value, currently only
+ /// supports row and col dimension and should be >= 1.0. For example, a valid
+ /// pooling ratio looks like [1.0, 1.44, 1.73, 1.0]. The first and last elements
+ /// must be 1.0 because we don't allow pooling on batch and channels
+ /// dimensions. 1.44 and 1.73 are pooling ratio on height and width dimensions
+ /// respectively.
+ ///
+ ///
+ /// When set to True, generates the pooling sequence in a
+ /// pseudorandom fashion, otherwise, in a random fashion. Check paper [Benjamin
+ /// Graham, Fractional Max-Pooling](http://arxiv.org/abs/1412.6071) for
+ /// difference between pseudorandom and random.
+ ///
+ ///
+ /// When set to True, it means when pooling, the values at the boundary
+ /// of adjacent pooling cells are used by both cells. For example:
+ ///
+ /// index 0 1 2 3 4
+ ///
+ /// value 20 5 16 3 7
+ ///
+ /// If the pooling sequence is [0, 2, 4], then 16, at index 2 will be used twice.
+ /// The result would be [41/3, 26/3] for fractional avg pooling.
+ ///
+ ///
+ /// When set to True, a fixed pooling region will be used when
+ /// iterating over a FractionalAvgPool node in the computation graph. Mainly used
+ /// in unit test to make FractionalAvgPool deterministic.
+ ///
+ ///
+ /// If either seed or seed2 are set to be non-zero, the random number
+ /// generator is seeded by the given seed. Otherwise, it is seeded by a
+ /// random seed.
+ ///
+ ///
+ /// An second seed to avoid seed collision.
+ ///
+ ///
+ /// Returns a tuple with multiple values, as follows:
+ /// output : output tensor after fractional avg pooling.
+ /// row_pooling_sequence : row pooling sequence, needed to calculate gradient.
+ /// col_pooling_sequence : column pooling sequence, needed to calculate gradient.
+ /// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
+ ///
+ ///
+ /// Fractional average pooling is similar to Fractional max pooling in the pooling
+ /// region generation step. The only difference is that after pooling regions are
+ /// generated, a mean operation is performed instead of a max operation in each
+ /// pooling region.
+ ///
+ public static (Tensor output, Tensor row_pooling_sequence, Tensor col_pooling_sequence) fractional_avg_pool (Tensor value, float[] pooling_ratio, bool? pseudo_random = null, bool? overlapping = null, bool? deterministic = null, int? seed = null, int? seed2 = null, string name = "FractionalAvgPool")
+ {
+ var dict = new Dictionary();
+ dict["value"] = value;
+ dict["pooling_ratio"] = pooling_ratio;
+ if (pseudo_random.HasValue)
+ dict["pseudo_random"] = pseudo_random.Value;
+ if (overlapping.HasValue)
+ dict["overlapping"] = overlapping.Value;
+ if (deterministic.HasValue)
+ dict["deterministic"] = deterministic.Value;
+ if (seed.HasValue)
+ dict["seed"] = seed.Value;
+ if (seed2.HasValue)
+ dict["seed2"] = seed2.Value;
+ var op = _op_def_lib._apply_op_helper("FractionalAvgPool", name: name, keywords: dict);
+ int _idx = 0;
+ var output = op.outputs[_idx++];
+ var row_pooling_sequence = op.outputs[_idx++];
+ var col_pooling_sequence = op.outputs[_idx++];
+ return (output, row_pooling_sequence, col_pooling_sequence);
+ }
+
+ ///
+ /// Computes gradient of the FractionalAvgPool function.
+ ///
+ ///
+ /// Original input tensor shape for fractional_avg_pool
+ ///
+ ///
+ /// 4-D with shape [batch, height, width, channels]. Gradients
+ /// w.r.t. the output of fractional_avg_pool.
+ ///
+ ///
+ /// row pooling sequence, form pooling region with
+ /// col_pooling_sequence.
+ ///
+ ///
+ /// column pooling sequence, form pooling region with
+ /// row_pooling sequence.
+ ///
+ ///
+ /// If specified, the created operation in the graph will be this one, otherwise it will be named 'FractionalAvgPoolGrad'.
+ ///
+ ///
+ /// When set to True, it means when pooling, the values at the boundary
+ /// of adjacent pooling cells are used by both cells. For example:
+ ///
+ /// index 0 1 2 3 4
+ ///
+ /// value 20 5 16 3 7
+ ///
+ /// If the pooling sequence is [0, 2, 4], then 16, at index 2 will be used twice.
+ /// The result would be [41/3, 26/3] for fractional avg pooling.
+ ///
+ ///
+ /// 4-D. Gradients w.r.t. the input of