From 8420337627a5b22ef615c5cac92c047182bf1e91 Mon Sep 17 00:00:00 2001 From: glopesdev Date: Thu, 7 Apr 2022 16:57:48 +0100 Subject: [PATCH] Update operations to TensorFlow 2.8.0 --- TensorFlowSharp/Operations.g.cs | 10799 +++++++++++++--- TensorFlowSharp/TensorFlowSharp.csproj | 19 +- .../nuget/build/net45/TensorFlowSharp.targets | 27 - 3 files changed, 8740 insertions(+), 2105 deletions(-) delete mode 100644 TensorFlowSharp/nuget/build/net45/TensorFlowSharp.targets diff --git a/TensorFlowSharp/Operations.g.cs b/TensorFlowSharp/Operations.g.cs index 91b76688..7bf1244b 100644 --- a/TensorFlowSharp/Operations.g.cs +++ b/TensorFlowSharp/Operations.g.cs @@ -252,6 +252,13 @@ public TFOutput AccumulatorTakeGradient (TFOutput handle, TFOutput num_required, /// /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// + /// + /// + /// Provided an input tensor, the tf.math.acos operation returns the inverse cosine of each element of the tensor. If y = tf.math.cos(x) then, x = tf.math.acos(y). + /// + /// Input range is [-1, 1] and the output has a range of [0, pi]. + /// + /// public TFOutput Acos (TFOutput x, string operName = null) { var desc = new TFOperationDesc (this, "Acos", MakeName ("Acos", operName)); @@ -314,6 +321,11 @@ public TFOutput Acosh (TFOutput x, string operName = null) /// /// *NOTE*: Add supports broadcasting. AddN does not. More about broadcasting /// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) + /// + /// Given two input tensors, the tf.add operation computes the sum for every element in the tensor. + /// + /// Both input and output have a range (-inf, inf). + /// /// public TFOutput Add (TFOutput x, TFOutput y, string operName = null) { @@ -628,7 +640,7 @@ public TFOutput AdjustContrastv2 (TFOutput images, TFOutput contrast_factor, str /// /// /// images is a tensor of at least 3 dimensions. The last dimension is - /// interpretted as channels, and must be three. + /// interpreted 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, @@ -666,7 +678,7 @@ public TFOutput AdjustHue (TFOutput images, TFOutput delta, string operName = nu /// /// /// images is a tensor of at least 3 dimensions. The last dimension is - /// interpretted as channels, and must be three. + /// interpreted 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 @@ -1362,10 +1374,10 @@ public TFOutput ApplyAdagradV2 (TFOutput var, TFOutput accum, TFOutput lr, TFOut /// The TFOperation can be fetched from the resulting TFOutput, by fethching 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)$$ + /// $$\text{lr}_t := \mathrm{lr} \cdot \frac{\sqrt{1 - \beta_2^t}}{1 - \beta_1^t}$$ + /// $$m_t := \beta_1 \cdot m_{t-1} + (1 - \beta_1) \cdot g$$ + /// $$v_t := \beta_2 \cdot v_{t-1} + (1 - \beta_2) \cdot g^2$$ + /// $$\text{var} := \begin{cases} \text{var} - (m_t \beta_1 + g \cdot (1 - \beta_1))\cdot\text{lr}_t/(\sqrt{v_t} + \epsilon), &\text{if use_nesterov}\\\\ \text{var} - m_t \cdot \text{lr}_t /(\sqrt{v_t} + \epsilon), &\text{otherwise} \end{cases}$$ /// public TFOutput ApplyAdam (TFOutput var, TFOutput m, TFOutput v, TFOutput beta1_power, TFOutput beta2_power, TFOutput lr, TFOutput beta1, TFOutput beta2, TFOutput epsilon, TFOutput grad, bool? use_locking = null, bool? use_nesterov = null, string operName = null) { @@ -1553,6 +1565,7 @@ public TFOutput ApplyAddSign (TFOutput var, TFOutput m, TFOutput lr, TFOutput al /// Decay rate. Must be a scalar. /// /// + /// Momentum Scale. Must be a scalar. /// /// /// Ridge term. Must be a scalar. @@ -1636,10 +1649,10 @@ public TFOutput ApplyCenteredRMSProp (TFOutput var, TFOutput mg, TFOutput ms, TF /// Scaling factor. Must be a scalar. /// /// - /// L1 regulariation. Must be a scalar. + /// L1 regularization. Must be a scalar. /// /// - /// L2 regulariation. Must be a scalar. + /// L2 regularization. Must be a scalar. /// /// /// Scaling factor. Must be a scalar. @@ -1653,18 +1666,21 @@ public TFOutput ApplyCenteredRMSProp (TFOutput var, TFOutput mg, TFOutput ms, TF /// by a lock; otherwise the behavior is undefined, but may exhibit less /// contention. /// + /// + /// Optional argument + /// /// /// Same as "var". /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// /// /// accum_new = accum + grad * grad - /// linear += grad + (accum_new^(-lr_power) - accum^(-lr_power)) / lr * var + /// 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| &gt; l1 else 0.0 /// accum = accum_new /// - public TFOutput ApplyFtrl (TFOutput var, TFOutput accum, TFOutput linear, TFOutput grad, TFOutput lr, TFOutput l1, TFOutput l2, TFOutput lr_power, bool? use_locking = null, string operName = null) + public TFOutput ApplyFtrl (TFOutput var, TFOutput accum, TFOutput linear, TFOutput grad, TFOutput lr, TFOutput l1, TFOutput l2, TFOutput lr_power, bool? use_locking = null, bool? multiply_linear_by_lr = null, string operName = null) { var desc = new TFOperationDesc (this, "ApplyFtrl", MakeName ("ApplyFtrl", operName)); desc.AddInput (var); @@ -1681,6 +1697,9 @@ public TFOutput ApplyFtrl (TFOutput var, TFOutput accum, TFOutput linear, TFOutp if (use_locking.HasValue) desc.SetAttr ("use_locking", use_locking.Value); + if (multiply_linear_by_lr.HasValue) + desc.SetAttr ("multiply_linear_by_lr", multiply_linear_by_lr.Value); + var op = desc.FinishOperation (); int _idx = 0; var output = new TFOutput (op, _idx++); @@ -1706,10 +1725,10 @@ public TFOutput ApplyFtrl (TFOutput var, TFOutput accum, TFOutput linear, TFOutp /// Scaling factor. Must be a scalar. /// /// - /// L1 regulariation. Must be a scalar. + /// L1 regularization. Must be a scalar. /// /// - /// L2 shrinkage regulariation. Must be a scalar. + /// L2 shrinkage regularization. Must be a scalar. /// /// /// @@ -1725,20 +1744,23 @@ public TFOutput ApplyFtrl (TFOutput var, TFOutput accum, TFOutput linear, TFOutp /// by a lock; otherwise the behavior is undefined, but may exhibit less /// contention. /// + /// + /// Optional argument + /// /// /// Same as "var". /// The TFOperation can be fetched from the resulting TFOutput, by fethching 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 = accum + grad * grad + /// 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| &gt; l1 else 0.0 /// accum = accum_new /// - public TFOutput ApplyFtrlV2 (TFOutput var, TFOutput accum, TFOutput linear, TFOutput grad, TFOutput lr, TFOutput l1, TFOutput l2, TFOutput l2_shrinkage, TFOutput lr_power, bool? use_locking = null, string operName = null) + public TFOutput ApplyFtrlV2 (TFOutput var, TFOutput accum, TFOutput linear, TFOutput grad, TFOutput lr, TFOutput l1, TFOutput l2, TFOutput l2_shrinkage, TFOutput lr_power, bool? use_locking = null, bool? multiply_linear_by_lr = null, string operName = null) { var desc = new TFOperationDesc (this, "ApplyFtrlV2", MakeName ("ApplyFtrlV2", operName)); desc.AddInput (var); @@ -1756,6 +1778,9 @@ public TFOutput ApplyFtrlV2 (TFOutput var, TFOutput accum, TFOutput linear, TFOu if (use_locking.HasValue) desc.SetAttr ("use_locking", use_locking.Value); + if (multiply_linear_by_lr.HasValue) + desc.SetAttr ("multiply_linear_by_lr", multiply_linear_by_lr.Value); + var op = desc.FinishOperation (); int _idx = 0; var output = new TFOutput (op, _idx++); @@ -1805,7 +1830,7 @@ public TFOutput ApplyGradientDescent (TFOutput var, TFOutput alpha, TFOutput del } /// - /// Update '*var' according to the momentum scheme. Set use_nesterov = True if you + /// Update '*var' according to the momentum scheme. /// /// /// Should be from a Variable(). @@ -1842,7 +1867,7 @@ public TFOutput ApplyGradientDescent (TFOutput var, TFOutput alpha, TFOutput del /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// /// - /// want to use Nesterov momentum. + /// Set use_nesterov = True if you want to use Nesterov momentum. /// /// accum = accum * momentum + grad /// var -= lr * accum @@ -2686,6 +2711,13 @@ public TFOperation AssignVariableOp (TFOutput resource, TFOutput value, string o /// For Unicode, see the /// [https://www.tensorflow.org/tutorials/representation/unicode](Working with Unicode text) /// tutorial. + /// + /// Examples: + /// + /// &gt;&gt;&gt; tf.strings.as_string([3, 2]) + /// &lt;tf.Tensor: shape=(2,), dtype=string, numpy=array([b'3', b'2'], dtype=object)&gt; + /// &gt;&gt;&gt; tf.strings.as_string([3.1415926, 2.71828], precision=2).numpy() + /// array([b'3.14', b'2.72'], dtype=object) /// public TFOutput AsString (TFOutput input, long? precision = null, bool? scientific = null, bool? shortest = null, long? width = null, string fill = null, string operName = null) { @@ -2771,11 +2803,20 @@ public TFOutput Atan (TFOutput x, string operName = null) /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// /// - /// This is the angle \( \theta \in [-\pi, \pi] \) such that - /// \[ x = r \cos(\theta) \] + /// 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) \). + /// \\[ y = r \sin(\theta) \\] + /// where \\(r = \sqrt{x^2 + y^2} \\). + /// + /// For example: + /// + /// &gt;&gt;&gt; x = [1., 1.] + /// &gt;&gt;&gt; y = [1., -1.] + /// &gt;&gt;&gt; print((tf.math.atan2(y,x) * (180 / np.pi)).numpy()) + /// [ 45. -45.] + /// + /// /// public TFOutput Atan2 (TFOutput y, TFOutput x, string operName = null) { @@ -3020,6 +3061,12 @@ public TFOutput AudioSummaryV2 (TFOutput tag, TFOutput tensor, TFOutput sample_r /// /// If specified, the created operation in the graph will be this one, otherwise it will be named 'AutoShardDataset'. /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// /// /// /// @@ -3036,7 +3083,7 @@ public TFOutput AudioSummaryV2 (TFOutput tag, TFOutput tensor, TFOutput sample_r /// This dataset will throw a NotFound error if we cannot shard the dataset /// automatically. /// - public TFOutput AutoShardDataset (TFOutput input_dataset, TFOutput num_workers, TFOutput index, TFDataType[] output_types, TFShape[] output_shapes, string operName = null) + public TFOutput AutoShardDataset (TFOutput input_dataset, TFOutput num_workers, TFOutput index, TFDataType[] output_types, TFShape[] output_shapes, long? auto_shard_policy = null, long? num_replicas = null, string operName = null) { var desc = new TFOperationDesc (this, "AutoShardDataset", MakeName ("AutoShardDataset", operName)); desc.AddInput (input_dataset); @@ -3047,6 +3094,12 @@ public TFOutput AutoShardDataset (TFOutput input_dataset, TFOutput num_workers, desc.SetAttrType ("output_types", output_types); desc.SetAttrShape ("output_shapes", output_shapes); + if (auto_shard_policy.HasValue) + desc.SetAttr ("auto_shard_policy", auto_shard_policy.Value); + + if (num_replicas.HasValue) + desc.SetAttr ("num_replicas", num_replicas.Value); + var op = desc.FinishOperation (); int _idx = 0; var handle = new TFOutput (op, _idx++); @@ -3138,6 +3191,10 @@ public TFOutput AvgPool (TFOutput value, long[] ksize, long[] strides, string pa /// The average pooled output tensor. /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// + /// + /// Each entry in output is the mean of the corresponding size ksize window in + /// value. + /// public TFOutput AvgPool3D (TFOutput input, long[] ksize, long[] strides, string padding, string data_format = null, string operName = null) { var desc = new TFOperationDesc (this, "AvgPool3D", MakeName ("AvgPool3D", operName)); @@ -3879,6 +3936,79 @@ public TFOutput BatchMatMulV2 (TFOutput x, TFOutput y, bool? adj_x = null, bool? return 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 'BatchMatMulV3'. + /// + /// + /// Optional argument + /// If True, adjoint the slices of x. Defaults to False. + /// + /// + /// Optional argument + /// If True, adjoint the slices of y. Defaults to False. + /// + /// + /// If not spcified, Tout is the same type to input type. + /// + /// + /// 3-D or higher with shape [..., r_o, c_o] + /// The TFOperation can be fetched from the resulting TFOutput, by fethching 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[..., :, :]) + /// + /// *NOTE*: BatchMatMulV3 supports broadcasting in the batch dimensions. More + /// about broadcasting + /// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html). + /// + /// + public TFOutput BatchMatMulV3 (TFOutput x, TFOutput y, TFDataType Tout, bool? adj_x = null, bool? adj_y = null, string operName = null) + { + var desc = new TFOperationDesc (this, "BatchMatMulV3", MakeName ("BatchMatMulV3", operName)); + desc.AddInput (x); + desc.AddInput (y); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("Tout", Tout); + if (adj_x.HasValue) + desc.SetAttr ("adj_x", adj_x.Value); + + if (adj_y.HasValue) + desc.SetAttr ("adj_y", adj_y.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + /// /// Batch normalization. /// @@ -4273,66 +4403,6 @@ public TFOutput BatchToSpaceND (TFOutput input, TFOutput block_shape, TFOutput c return 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 TFOperation can be fetched from the resulting TFOutput, by fethching 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 TFOutput BesselI0e (TFOutput x, string operName = null) - { - var desc = new TFOperationDesc (this, "BesselI0e", MakeName ("BesselI0e", operName)); - desc.AddInput (x); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - var op = desc.FinishOperation (); - int _idx = 0; - var y = new TFOutput (op, _idx++); - return y; - } - - /// - /// 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 TFOperation can be fetched from the resulting TFOutput, by fethching 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 TFOutput BesselI1e (TFOutput x, string operName = null) - { - var desc = new TFOperationDesc (this, "BesselI1e", MakeName ("BesselI1e", operName)); - desc.AddInput (x); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - var op = desc.FinishOperation (); - int _idx = 0; - var y = new TFOutput (op, _idx++); - return y; - } - /// /// Compute the regularized incomplete beta integral \\(I_x(a, b)\\). /// @@ -4505,73 +4575,6 @@ public TFOutput BiasAddV1 (TFOutput value, TFOutput bias, string operName = null return output; } - /// - /// A Reader that outputs rows from a BigQuery table as tensorflow Examples. - /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BigQueryReader'. - /// - /// - /// Optional argument - /// If non-empty, this reader is placed in the given container. - /// Otherwise, a default container is used. - /// - /// - /// Optional argument - /// If non-empty, this reader is named in the given bucket - /// with this shared_name. Otherwise, the node name is used instead. - /// - /// - /// Optional argument - /// Do not use. For testing purposes only. - /// - /// - /// GCP project ID. - /// - /// - /// BigQuery Dataset ID. - /// - /// - /// Table to read. - /// - /// - /// List of columns to read. Leave empty to read all columns. - /// - /// - /// Table snapshot timestamp in millis since epoch. Relative - /// (negative or zero) snapshot times are not allowed. For more details, see - /// 'Table Decorators' in BigQuery docs. - /// - /// - /// The handle to reference the Reader. - /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. - /// - public TFOutput BigQueryReader (string project_id, string dataset_id, string table_id, string[] columns, long timestamp_millis, string container = null, string shared_name = null, string test_end_point = null, string operName = null) - { - var desc = new TFOperationDesc (this, "BigQueryReader", MakeName ("BigQueryReader", operName)); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - desc.SetAttr ("project_id", project_id); - desc.SetAttr ("dataset_id", dataset_id); - desc.SetAttr ("table_id", table_id); - desc.SetAttr ("columns", columns); - desc.SetAttr ("timestamp_millis", timestamp_millis); - if (container != null) - desc.SetAttr ("container", container); - - if (shared_name != null) - desc.SetAttr ("shared_name", shared_name); - - if (test_end_point != null) - desc.SetAttr ("test_end_point", test_end_point); - - var op = desc.FinishOperation (); - int _idx = 0; - var reader_handle = new TFOutput (op, _idx++); - return reader_handle; - } - /// /// Counts the number of occurrences of each value in an integer array. /// @@ -5409,7 +5412,7 @@ public TFOutput[] BoostedTreesBucketize (TFOutput[] float_values, TFOutput[] buc /// adjustment to the gain, per leaf based. /// /// - /// mininum avg of hessians in a node before required for the node to be considered for splitting. + /// minimum 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 'BoostedTreesCalculateBestFeatureSplit'. @@ -5470,6 +5473,90 @@ public TFOutput[] BoostedTreesBucketize (TFOutput[] float_values, TFOutput[] buc return (node_ids, gains, feature_dimensions, thresholds, left_node_contribs, right_node_contribs, split_with_default_directions); } + /// + /// Calculates gains for each feature and returns the best possible split information for each node. However, if no split is found, then no split information is returned for that node. + /// + /// + /// 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 4 tensor (#shape=[max_splits, feature_dims, bucket, stats_dims]) for accumulated stats summary (gradient/hessian) per node, per dimension, 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. + /// + /// + /// A Rank 1 tensor indicating if this Op should perform inequality split or equality split per feature. + /// + /// + /// Rank 1 tensor with ids for each feature. This is the real id of the feature. + /// + /// + /// 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. + /// + /// + /// minimum 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 'BoostedTreesCalculateBestFeatureSplitV2'. + /// + /// + /// The dimension of logit, i.e., number of classes. + /// + /// + /// Returns a tuple with multiple values, as follows: + /// node_ids: A 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: A Rank 1 tensor indicating the best gains for each feature to split for certain nodes. See above for details like shapes and sizes. + /// feature_ids: A Rank 1 tensors indicating the best feature id for each node. See above for details like shapes and sizes. + /// feature_dimensions: A Rank 1 tensors indicating the best feature dimension for each feature to split for certain nodes if the feature is multi-dimension. See above for details like shapes and sizes. + /// thresholds: A 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: A 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: A Rank 2 tensors, with the same shape/conditions as left_node_contribs_list, but just that the value is for the right node. + /// split_with_default_directions: A Rank 1 tensors indicating the which direction to go if data is missing. See above for details like shapes and sizes. + /// Inequality with default left returns 0, inequality with default right returns 1, equality with default right returns 2. + /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching 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 output shapes are compatible in a way that the first dimension of all tensors are the same and equal to the number of possible split nodes for each feature. + /// + public (TFOutput node_ids, TFOutput gains, TFOutput feature_ids, TFOutput feature_dimensions, TFOutput thresholds, TFOutput left_node_contribs, TFOutput right_node_contribs, TFOutput split_with_default_directions) BoostedTreesCalculateBestFeatureSplitV2 (TFOutput node_id_range, TFOutput[] stats_summaries_list, TFOutput split_types, TFOutput candidate_feature_ids, TFOutput l1, TFOutput l2, TFOutput tree_complexity, TFOutput min_node_weight, long logits_dimension, string operName = null) + { + var desc = new TFOperationDesc (this, "BoostedTreesCalculateBestFeatureSplitV2", MakeName ("BoostedTreesCalculateBestFeatureSplitV2", operName)); + desc.AddInput (node_id_range); + desc.AddInputs (stats_summaries_list); + desc.AddInput (split_types); + desc.AddInput (candidate_feature_ids); + desc.AddInput (l1); + desc.AddInput (l2); + desc.AddInput (tree_complexity); + desc.AddInput (min_node_weight); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("logits_dimension", logits_dimension); + var op = desc.FinishOperation (); + int _idx = 0; + var node_ids = new TFOutput (op, _idx++); + var gains = new TFOutput (op, _idx++); + var feature_ids = new TFOutput (op, _idx++); + var feature_dimensions = new TFOutput (op, _idx++); + var thresholds = new TFOutput (op, _idx++); + var left_node_contribs = new TFOutput (op, _idx++); + var right_node_contribs = new TFOutput (op, _idx++); + var split_with_default_directions = new TFOutput (op, _idx++); + return (node_ids, gains, feature_ids, feature_dimensions, thresholds, left_node_contribs, right_node_contribs, split_with_default_directions); + } + /// /// Calculates gains for each feature and returns the best possible split information for the feature. /// @@ -5489,7 +5576,7 @@ public TFOutput[] BoostedTreesBucketize (TFOutput[] float_values, TFOutput[] buc /// adjustment to the gain, per leaf based. /// /// - /// mininum avg of hessians in a node before required for the node to be considered for splitting. + /// minimum 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'. @@ -6290,7 +6377,7 @@ public TFOutput BoostedTreesQuantileStreamResourceHandleOp (string container = n /// adjustment to the gain, per leaf based. /// /// - /// mininum avg of hessians in a node before required for the node to be considered for splitting. + /// minimum 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 'BoostedTreesSparseCalculateBestFeatureSplit'. @@ -6480,6 +6567,91 @@ public TFOperation BoostedTreesUpdateEnsemble (TFOutput tree_ensemble_handle, TF return op; } + /// + /// Updates the tree ensemble by 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 dimension in each feature. + /// + /// + /// 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. + /// + /// + /// List of rank 1 tensors representing the split type for each feature. + /// + /// + /// Max depth of the tree to build. + /// + /// + /// shrinkage const for each new tree. + /// + /// + /// 0-No pruning, 1-Pre-pruning, 2-Post-pruning. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'BoostedTreesUpdateEnsembleV2'. + /// + /// + /// Optional argument + /// scalar, dimension of the logits + /// + /// + /// Returns the description of the operation + /// + /// + /// or by starting a new tree. + /// + public TFOperation BoostedTreesUpdateEnsembleV2 (TFOutput tree_ensemble_handle, TFOutput[] feature_ids, TFOutput[] dimension_ids, TFOutput[] node_ids, TFOutput[] gains, TFOutput[] thresholds, TFOutput[] left_node_contribs, TFOutput[] right_node_contribs, TFOutput[] split_types, TFOutput max_depth, TFOutput learning_rate, TFOutput pruning_mode, long? logits_dimension = null, string operName = null) + { + var desc = new TFOperationDesc (this, "BoostedTreesUpdateEnsembleV2", MakeName ("BoostedTreesUpdateEnsembleV2", operName)); + desc.AddInput (tree_ensemble_handle); + desc.AddInputs (feature_ids); + desc.AddInputs (dimension_ids); + desc.AddInputs (node_ids); + desc.AddInputs (gains); + desc.AddInputs (thresholds); + desc.AddInputs (left_node_contribs); + desc.AddInputs (right_node_contribs); + desc.AddInputs (split_types); + desc.AddInput (max_depth); + desc.AddInput (learning_rate); + desc.AddInput (pruning_mode); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (logits_dimension.HasValue) + desc.SetAttr ("logits_dimension", logits_dimension.Value); + + var op = desc.FinishOperation (); + return op; + } + /// /// Return the shape of s0 op s1 with broadcast. /// @@ -6580,6 +6752,15 @@ public TFOutput BroadcastArgs (TFOutput s0, TFOutput s1, string operName = null) /// /// In the above example, the input Tensor with the shape of [1, 3] /// is broadcasted to output Tensor with shape of [3, 3]. + /// + /// When doing broadcasted operations such as multiplying a tensor + /// by a scalar, broadcasting (usually) confers some time or space + /// benefit, as the broadcasted tensor is never materialized. + /// + /// However, broadcast_to does not carry with it any such benefits. + /// The newly-created tensor takes the full memory of the broadcasted + /// shape. (In a graph context, broadcast_to might be fused to + /// subsequent operation and then be optimized away, however.) /// public TFOutput BroadcastTo (TFOutput input, TFOutput shape, string operName = null) { @@ -6788,7 +6969,29 @@ public TFOutput Ceil (TFOutput x, string operName = null) /// /// /// 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. + /// that are not a number (NaN) or infinity (Inf). Otherwise, returns the input + /// tensor. + /// + /// Example usage: + /// + /// + /// python + /// a = tf.Variable(1.0) + /// tf.debugging.check_numerics(a, message='') + /// + /// b = tf.Variable(np.nan) + /// try: + /// tf.debugging.check_numerics(b, message='Checking b') + /// except Exception as e: + /// assert "Checking b : Tensor had NaN values" in e.message + /// + /// c = tf.Variable(np.inf) + /// try: + /// tf.debugging.check_numerics(c, message='Checking c') + /// except Exception as e: + /// assert "Checking c : Tensor had Inf values" in e.message + /// + /// /// public TFOutput CheckNumerics (TFOutput tensor, string message, string operName = null) { @@ -6804,6 +7007,40 @@ public TFOutput CheckNumerics (TFOutput tensor, string message, string operName return output; } + /// + /// Checks a tensor for NaN, -Inf and +Inf values. + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CheckNumericsV2'. + /// + /// + /// Prefix of the error message. + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching 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, returns the input + /// tensor. Unlike CheckNumerics (V1), CheckNumericsV2 distinguishes -Inf and +Inf + /// in the errors it throws. + /// + public TFOutput CheckNumericsV2 (TFOutput tensor, string message, string operName = null) + { + var desc = new TFOperationDesc (this, "CheckNumericsV2", MakeName ("CheckNumericsV2", operName)); + desc.AddInput (tensor); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("message", message); + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + /// /// Computes the Cholesky decomposition of one or more square matrices. /// @@ -6934,6 +7171,9 @@ public TFOutput ClipByValue (TFOutput t, TFOutput clip_value_min, TFOutput clip_ /// /// Optional argument /// + /// + /// Optional argument + /// /// /// /// @@ -6947,7 +7187,7 @@ public TFOutput ClipByValue (TFOutput t, TFOutput clip_value_min, TFOutput clip_ /// /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// - public TFOutput CollectiveBcastRecv (TFDataType T, long group_size, long group_key, long instance_key, TFShape shape, string communication_hint = null, string operName = null) + public TFOutput CollectiveBcastRecv (TFDataType T, long group_size, long group_key, long instance_key, TFShape shape, string communication_hint = null, float? timeout_seconds = null, string operName = null) { var desc = new TFOperationDesc (this, "CollectiveBcastRecv", MakeName ("CollectiveBcastRecv", operName)); foreach ( TFOperation control in CurrentDependencies ) @@ -6961,6 +7201,57 @@ public TFOutput CollectiveBcastRecv (TFDataType T, long group_size, long group_k if (communication_hint != null) desc.SetAttr ("communication_hint", communication_hint); + if (timeout_seconds.HasValue) + desc.SetAttr ("timeout_seconds", timeout_seconds.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var data = new TFOutput (op, _idx++); + return data; + } + + /// + /// 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 'CollectiveBcastRecvV2'. + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + public TFOutput CollectiveBcastRecvV2 (TFOutput group_size, TFOutput group_key, TFOutput instance_key, TFOutput shape, TFDataType T, string communication_hint = null, float? timeout_seconds = null, string operName = null) + { + var desc = new TFOperationDesc (this, "CollectiveBcastRecvV2", MakeName ("CollectiveBcastRecvV2", operName)); + desc.AddInput (group_size); + desc.AddInput (group_key); + desc.AddInput (instance_key); + desc.AddInput (shape); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("T", T); + if (communication_hint != null) + desc.SetAttr ("communication_hint", communication_hint); + + if (timeout_seconds.HasValue) + desc.SetAttr ("timeout_seconds", timeout_seconds.Value); + var op = desc.FinishOperation (); int _idx = 0; var data = new TFOutput (op, _idx++); @@ -6978,6 +7269,9 @@ public TFOutput CollectiveBcastRecv (TFDataType T, long group_size, long group_k /// /// Optional argument /// + /// + /// Optional argument + /// /// /// /// @@ -6989,7 +7283,7 @@ public TFOutput CollectiveBcastRecv (TFDataType T, long group_size, long group_k /// /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// - public TFOutput CollectiveBcastSend (TFOutput input, long group_size, long group_key, long instance_key, TFShape shape, string communication_hint = null, string operName = null) + public TFOutput CollectiveBcastSend (TFOutput input, long group_size, long group_key, long instance_key, TFShape shape, string communication_hint = null, float? timeout_seconds = null, string operName = null) { var desc = new TFOperationDesc (this, "CollectiveBcastSend", MakeName ("CollectiveBcastSend", operName)); desc.AddInput (input); @@ -7003,6 +7297,54 @@ public TFOutput CollectiveBcastSend (TFOutput input, long group_size, long group if (communication_hint != null) desc.SetAttr ("communication_hint", communication_hint); + if (timeout_seconds.HasValue) + desc.SetAttr ("timeout_seconds", timeout_seconds.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var data = new TFOutput (op, _idx++); + return data; + } + + /// + /// 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 'CollectiveBcastSendV2'. + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + public TFOutput CollectiveBcastSendV2 (TFOutput input, TFOutput group_size, TFOutput group_key, TFOutput instance_key, string communication_hint = null, float? timeout_seconds = null, string operName = null) + { + var desc = new TFOperationDesc (this, "CollectiveBcastSendV2", MakeName ("CollectiveBcastSendV2", operName)); + desc.AddInput (input); + desc.AddInput (group_size); + desc.AddInput (group_key); + desc.AddInput (instance_key); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (communication_hint != null) + desc.SetAttr ("communication_hint", communication_hint); + + if (timeout_seconds.HasValue) + desc.SetAttr ("timeout_seconds", timeout_seconds.Value); + var op = desc.FinishOperation (); int _idx = 0; var data = new TFOutput (op, _idx++); @@ -7020,6 +7362,9 @@ public TFOutput CollectiveBcastSend (TFOutput input, long group_size, long group /// /// Optional argument /// + /// + /// Optional argument + /// /// /// /// @@ -7031,7 +7376,7 @@ public TFOutput CollectiveBcastSend (TFOutput input, long group_size, long group /// /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// - public TFOutput CollectiveGather (TFOutput input, long group_size, long group_key, long instance_key, TFShape shape, string communication_hint = null, string operName = null) + public TFOutput CollectiveGather (TFOutput input, long group_size, long group_key, long instance_key, TFShape shape, string communication_hint = null, float? timeout_seconds = null, string operName = null) { var desc = new TFOperationDesc (this, "CollectiveGather", MakeName ("CollectiveGather", operName)); desc.AddInput (input); @@ -7045,6 +7390,57 @@ public TFOutput CollectiveGather (TFOutput input, long group_size, long group_ke if (communication_hint != null) desc.SetAttr ("communication_hint", communication_hint); + if (timeout_seconds.HasValue) + desc.SetAttr ("timeout_seconds", timeout_seconds.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var data = new TFOutput (op, _idx++); + return data; + } + + /// + /// Mutually accumulates multiple tensors of identical type and shape. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CollectiveGatherV2'. + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + public TFOutput CollectiveGatherV2 (TFOutput input, TFOutput group_size, TFOutput group_key, TFOutput instance_key, TFOutput[] ordering_token, string communication_hint = null, float? timeout_seconds = null, string operName = null) + { + var desc = new TFOperationDesc (this, "CollectiveGatherV2", MakeName ("CollectiveGatherV2", operName)); + desc.AddInput (input); + desc.AddInput (group_size); + desc.AddInput (group_key); + desc.AddInput (instance_key); + desc.AddInputs (ordering_token); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (communication_hint != null) + desc.SetAttr ("communication_hint", communication_hint); + + if (timeout_seconds.HasValue) + desc.SetAttr ("timeout_seconds", timeout_seconds.Value); + var op = desc.FinishOperation (); int _idx = 0; var data = new TFOutput (op, _idx++); @@ -7103,6 +7499,9 @@ public TFOutput CollectivePermute (TFOutput input, TFOutput source_target_pairs, /// /// Optional argument /// + /// + /// Optional argument + /// /// /// /// @@ -7118,7 +7517,7 @@ public TFOutput CollectivePermute (TFOutput input, TFOutput source_target_pairs, /// /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// - public TFOutput CollectiveReduce (TFOutput input, long group_size, long group_key, long instance_key, string merge_op, string final_op, long[] subdiv_offsets, long[] wait_for = null, string communication_hint = null, string operName = null) + public TFOutput CollectiveReduce (TFOutput input, long group_size, long group_key, long instance_key, string merge_op, string final_op, long[] subdiv_offsets, long[] wait_for = null, string communication_hint = null, float? timeout_seconds = null, string operName = null) { var desc = new TFOperationDesc (this, "CollectiveReduce", MakeName ("CollectiveReduce", operName)); desc.AddInput (input); @@ -7137,6 +7536,69 @@ public TFOutput CollectiveReduce (TFOutput input, long group_size, long group_ke if (communication_hint != null) desc.SetAttr ("communication_hint", communication_hint); + if (timeout_seconds.HasValue) + desc.SetAttr ("timeout_seconds", timeout_seconds.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var data = new TFOutput (op, _idx++); + return data; + } + + /// + /// 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 'CollectiveReduceV2'. + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// + /// + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + public TFOutput CollectiveReduceV2 (TFOutput input, TFOutput group_size, TFOutput group_key, TFOutput instance_key, TFOutput[] ordering_token, string merge_op, string final_op, string communication_hint = null, float? timeout_seconds = null, long? max_subdivs_per_device = null, string operName = null) + { + var desc = new TFOperationDesc (this, "CollectiveReduceV2", MakeName ("CollectiveReduceV2", operName)); + desc.AddInput (input); + desc.AddInput (group_size); + desc.AddInput (group_key); + desc.AddInput (instance_key); + desc.AddInputs (ordering_token); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("merge_op", merge_op); + desc.SetAttr ("final_op", final_op); + if (communication_hint != null) + desc.SetAttr ("communication_hint", communication_hint); + + if (timeout_seconds.HasValue) + desc.SetAttr ("timeout_seconds", timeout_seconds.Value); + + if (max_subdivs_per_device.HasValue) + desc.SetAttr ("max_subdivs_per_device", max_subdivs_per_device.Value); + var op = desc.FinishOperation (); int _idx = 0; var data = new TFOutput (op, _idx++); @@ -7160,7 +7622,9 @@ public TFOutput CollectiveReduce (TFOutput input, long group_size, long group_ke /// boxes to be selected by non max suppression per class /// /// - /// A scalar representing maximum number of boxes retained over all classes. + /// An int32 scalar representing the maximum number of boxes retained over all + /// classes. Note that setting this value to a large number may result in OOM error + /// depending on the system workload. /// /// /// A 0-D float tensor representing the threshold for deciding whether @@ -7243,61 +7707,6 @@ public TFOutput CollectiveReduce (TFOutput input, long group_size, long group_ke return (nmsed_boxes, nmsed_scores, nmsed_classes, valid_detections); } - /// - /// 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 TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. - /// - /// - /// Each comparison returns a boolean true (if input_value &gt; 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 TFOutput CompareAndBitpack (TFOutput input, TFOutput threshold, string operName = null) - { - var desc = new TFOperationDesc (this, "CompareAndBitpack", MakeName ("CompareAndBitpack", operName)); - desc.AddInput (input); - desc.AddInput (threshold); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - var op = desc.FinishOperation (); - int _idx = 0; - var output = new TFOutput (op, _idx++); - return output; - } - /// /// Converts two real numbers to a complex number. /// @@ -7366,6 +7775,13 @@ public TFOutput Complex (TFOutput real, TFOutput imag, TFDataType? Tout = null, /// 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}\\). + /// + /// For example: + /// + /// &gt;&gt;&gt; x = tf.complex(3.0, 4.0) + /// &gt;&gt;&gt; print((tf.raw_ops.ComplexAbs(x=x, Tout=tf.dtypes.float32, name=None)).numpy()) + /// 5.0 + /// /// public TFOutput ComplexAbs (TFOutput x, TFDataType? Tout = null, string operName = null) { @@ -7383,6 +7799,112 @@ public TFOutput ComplexAbs (TFOutput x, TFDataType? Tout = null, string operName return y; } + /// + /// Encodes an ExtensionType value into a variant scalar Tensor. + /// + /// + /// The component tensors for the extension type value. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CompositeTensorVariantFromComponents'. + /// + /// + /// String serialization for the TypeSpec. (Note: the encoding for the TypeSpec + /// may change in future versions of TensorFlow.) + /// + /// + /// A variant Tensor that containing the encoded value. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Returns a scalar variant tensor containing a single CompositeTensorVariant + /// with the specified Tensor components and TypeSpec. + /// + public TFOutput CompositeTensorVariantFromComponents (TFOutput[] components, string metadata, string operName = null) + { + var desc = new TFOperationDesc (this, "CompositeTensorVariantFromComponents", MakeName ("CompositeTensorVariantFromComponents", operName)); + desc.AddInputs (components); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("metadata", metadata); + var op = desc.FinishOperation (); + int _idx = 0; + var encoded = new TFOutput (op, _idx++); + return encoded; + } + + /// + /// Decodes a variant scalar Tensor into an ExtensionType value. + /// + /// + /// A scalar variant Tensor containing an encoded ExtensionType value. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CompositeTensorVariantToComponents'. + /// + /// + /// String serialization for the TypeSpec. Must be compatible with the + /// TypeSpec contained in encoded. (Note: the encoding for the TypeSpec + /// may change in future versions of TensorFlow.) + /// + /// + /// Expected dtypes for components. + /// + /// + /// The component tensors for the ExtensionType value in encoded. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Returns the Tensor components encoded in a CompositeTensorVariant. + /// + /// Raises an error if type_spec_proto doesn't match the TypeSpec + /// in encoded. + /// + public TFOutput[] CompositeTensorVariantToComponents (TFOutput encoded, string metadata, TFDataType[] Tcomponents, string operName = null) + { + var desc = new TFOperationDesc (this, "CompositeTensorVariantToComponents", MakeName ("CompositeTensorVariantToComponents", operName)); + desc.AddInput (encoded); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("metadata", metadata); + desc.SetAttrType ("Tcomponents", Tcomponents); + var op = desc.FinishOperation (); + int _idx = 0; + int _n = 0; + _n = op.OutputListLength ("components"); + var components = new TFOutput [_n]; + for (int i = 0; i < _n; i++) + components [i] = new TFOutput (op, _idx++); + + return components; + } + + /// + /// Compresses a dataset element. + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CompressElement'. + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + public TFOutput CompressElement (TFOutput[] components, string operName = null) + { + var desc = new TFOperationDesc (this, "CompressElement", MakeName ("CompressElement", operName)); + desc.AddInputs (components); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var compressed = new TFOutput (op, _idx++); + return compressed; + } + /// /// Computes the ids of the positions in sampled_candidates that match true_labels. /// @@ -7446,6 +7968,30 @@ public TFOutput ComplexAbs (TFOutput x, TFDataType? Tout = null, string operName return (indices, ids, weights); } + /// + /// Computes the static batch size of a dataset sans partial batches. + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ComputeBatchSize'. + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + public TFOutput ComputeBatchSize (TFOutput input_dataset, string operName = null) + { + var desc = new TFOperationDesc (this, "ComputeBatchSize", MakeName ("ComputeBatchSize", operName)); + desc.AddInput (input_dataset); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var batch_size = new TFOutput (op, _idx++); + return batch_size; + } + /// /// Concatenates tensors along one dimension. /// @@ -7674,12 +8220,18 @@ public TFOutput ConditionalAccumulator (TFDataType dtype, TFShape shape, string /// Optional argument /// Reserved. Do not use. /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// /// /// A serialized tensorflow.tpu.TopologyProto that describes the TPU /// topology. /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// - public TFOutput ConfigureDistributedTPU (string embedding_config = null, string tpu_embedding_config = null, bool? is_global_init = null, string operName = null) + public TFOutput ConfigureDistributedTPU (string embedding_config = null, string tpu_embedding_config = null, bool? is_global_init = null, bool? enable_whole_mesh_compilations = null, bool? compilation_failure_closes_chips = null, string operName = null) { var desc = new TFOperationDesc (this, "ConfigureDistributedTPU", MakeName ("ConfigureDistributedTPU", operName)); foreach ( TFOperation control in CurrentDependencies ) @@ -7694,6 +8246,12 @@ public TFOutput ConfigureDistributedTPU (string embedding_config = null, string if (is_global_init.HasValue) desc.SetAttr ("is_global_init", is_global_init.Value); + if (enable_whole_mesh_compilations.HasValue) + desc.SetAttr ("enable_whole_mesh_compilations", enable_whole_mesh_compilations.Value); + + if (compilation_failure_closes_chips.HasValue) + desc.SetAttr ("compilation_failure_closes_chips", compilation_failure_closes_chips.Value); + var op = desc.FinishOperation (); int _idx = 0; var topology = new TFOutput (op, _idx++); @@ -8480,7 +9038,6 @@ public TFOutput Conv3DBackpropInputV2 (TFOutput input_sizes, TFOutput filter, TF /// "DebugIdentity;file:///tmp/tfdbg_1;0". /// /// - /// Output tensor, deep-copied from input. /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// /// @@ -8534,7 +9091,6 @@ public TFOutput Copy (TFOutput input, string tensor_name = null, string[] debug_ /// "DebugIdentity;file:///tmp/tfdbg_1;0". /// /// - /// Output tensor, deep-copied from input. /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// /// @@ -8943,6 +9499,111 @@ public TFOutput CrossReplicaSum (TFOutput input, TFOutput group_assignment, stri return output; } + /// + /// Reads out the CSR components at batch index. + /// + /// + /// A batched CSRSparseMatrix. + /// + /// + /// The index in csr_sparse_matrix's batch. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CSRSparseMatrixComponents'. + /// + /// + /// + /// + /// Returns a tuple with multiple values, as follows: + /// row_ptrs: An array containing CSR matrix row pointers. + /// col_inds: An array containing CSR matrix column indices. + /// values: An array containing CSR matrix nonzero values. + /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. + /// + /// + /// This op is meant only for debugging / testing, and its interface is not expected + /// to be stable. + /// + public (TFOutput row_ptrs, TFOutput col_inds, TFOutput values) CSRSparseMatrixComponents (TFOutput csr_sparse_matrix, TFOutput index, TFDataType type, string operName = null) + { + var desc = new TFOperationDesc (this, "CSRSparseMatrixComponents", MakeName ("CSRSparseMatrixComponents", operName)); + desc.AddInput (csr_sparse_matrix); + desc.AddInput (index); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("type", type); + var op = desc.FinishOperation (); + int _idx = 0; + var row_ptrs = new TFOutput (op, _idx++); + var col_inds = new TFOutput (op, _idx++); + var values = new TFOutput (op, _idx++); + return (row_ptrs, col_inds, values); + } + + /// + /// Convert a (possibly batched) CSRSparseMatrix to dense. + /// + /// + /// A batched CSRSparseMatrix. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CSRSparseMatrixToDense'. + /// + /// + /// + /// + /// A dense tensor. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + public TFOutput CSRSparseMatrixToDense (TFOutput sparse_input, TFDataType type, string operName = null) + { + var desc = new TFOperationDesc (this, "CSRSparseMatrixToDense", MakeName ("CSRSparseMatrixToDense", operName)); + desc.AddInput (sparse_input); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("type", type); + var op = desc.FinishOperation (); + int _idx = 0; + var dense_output = new TFOutput (op, _idx++); + return dense_output; + } + + /// + /// Converts a (possibly batched) CSRSparesMatrix to a SparseTensor. + /// + /// + /// A (possibly batched) CSRSparseMatrix. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'CSRSparseMatrixToSparseTensor'. + /// + /// + /// + /// + /// Returns a tuple with multiple values, as follows: + /// indices: SparseTensor indices. + /// values: SparseTensor values. + /// dense_shape: SparseTensor dense shape. + /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. + /// + public (TFOutput indices, TFOutput values, TFOutput dense_shape) CSRSparseMatrixToSparseTensor (TFOutput sparse_matrix, TFDataType type, string operName = null) + { + var desc = new TFOperationDesc (this, "CSRSparseMatrixToSparseTensor", MakeName ("CSRSparseMatrixToSparseTensor", operName)); + desc.AddInput (sparse_matrix); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("type", type); + var op = desc.FinishOperation (); + int _idx = 0; + var indices = new TFOutput (op, _idx++); + var values = new TFOutput (op, _idx++); + var dense_shape = new TFOutput (op, _idx++); + return (indices, values, dense_shape); + } + /// /// Performs beam search decoding on the logits given in input. /// @@ -9038,6 +9699,9 @@ public TFOutput CrossReplicaSum (TFOutput input, TFOutput group_assignment, stri /// Optional argument /// If True, merge repeated classes in output. /// + /// + /// Optional argument + /// /// /// Returns a tuple with multiple values, as follows: /// decoded_indices: Indices matrix, size (total_decoded_outputs x 2), @@ -9061,7 +9725,7 @@ public TFOutput CrossReplicaSum (TFOutput input, TFOutput group_assignment, stri /// time and batch corresponds to the blank, index (num_classes - 1), no new /// element is emitted. /// - public (TFOutput decoded_indices, TFOutput decoded_values, TFOutput decoded_shape, TFOutput log_probability) CTCGreedyDecoder (TFOutput inputs, TFOutput sequence_length, bool? merge_repeated = null, string operName = null) + public (TFOutput decoded_indices, TFOutput decoded_values, TFOutput decoded_shape, TFOutput log_probability) CTCGreedyDecoder (TFOutput inputs, TFOutput sequence_length, bool? merge_repeated = null, long? blank_index = null, string operName = null) { var desc = new TFOperationDesc (this, "CTCGreedyDecoder", MakeName ("CTCGreedyDecoder", operName)); desc.AddInput (inputs); @@ -9072,6 +9736,9 @@ public TFOutput CrossReplicaSum (TFOutput input, TFOutput group_assignment, stri if (merge_repeated.HasValue) desc.SetAttr ("merge_repeated", merge_repeated.Value); + if (blank_index.HasValue) + desc.SetAttr ("blank_index", blank_index.Value); + var op = desc.FinishOperation (); int _idx = 0; var decoded_indices = new TFOutput (op, _idx++); @@ -9155,6 +9822,81 @@ public TFOutput CrossReplicaSum (TFOutput input, TFOutput group_assignment, stri return (loss, gradient); } + /// + /// 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. Default blank + /// label is 0 rather num_classes - 1. + /// + /// + /// The indices of a SparseTensor&lt;int32, 2&gt;. + /// 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 'CTCLossV2'. + /// + /// + /// Optional argument + /// Scalar, if true then repeated labels are + /// collapsed prior to the CTC calculation. + /// + /// + /// Optional argument + /// 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. + /// + /// + /// Optional argument + /// 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 TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching 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 (TFOutput loss, TFOutput gradient) CTCLossV2 (TFOutput inputs, TFOutput labels_indices, TFOutput labels_values, TFOutput sequence_length, bool? preprocess_collapse_repeated = null, bool? ctc_merge_repeated = null, bool? ignore_longer_outputs_than_inputs = null, string operName = null) + { + var desc = new TFOperationDesc (this, "CTCLossV2", MakeName ("CTCLossV2", operName)); + desc.AddInput (inputs); + desc.AddInput (labels_indices); + desc.AddInput (labels_values); + desc.AddInput (sequence_length); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (preprocess_collapse_repeated.HasValue) + desc.SetAttr ("preprocess_collapse_repeated", preprocess_collapse_repeated.Value); + + if (ctc_merge_repeated.HasValue) + desc.SetAttr ("ctc_merge_repeated", ctc_merge_repeated.Value); + + if (ignore_longer_outputs_than_inputs.HasValue) + desc.SetAttr ("ignore_longer_outputs_than_inputs", ignore_longer_outputs_than_inputs.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var loss = new TFOutput (op, _idx++); + var gradient = new TFOutput (op, _idx++); + return (loss, gradient); + } + /// /// A RNN backed by cuDNN. /// @@ -9225,7 +9967,7 @@ public TFOutput CrossReplicaSum (TFOutput input, TFOutput group_assignment, stri /// 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 + /// is_training: Indicates whether this operation is used for inference or /// training. /// reserve_space: An opaque tensor that can be used in backprop calculation. It /// is only produced if is_training is false. @@ -9879,7 +10621,7 @@ public TFOutput CudnnRNNCanonicalToParams (TFOutput num_layers, TFOutput num_uni /// 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_weigths: number of weight parameter matrix for all layers. + /// num_params_weights: number of weight parameter matrix for all layers. /// num_params_biases: number of bias parameter vector for all layers. /// rnn_mode: Indicates the type of the RNN model. /// input_mode: Indicate whether there is a linear projection between the input and @@ -10205,7 +10947,7 @@ public TFOutput CudnnRNNParamsSize (TFOutput num_layers, TFOutput num_units, TFO /// 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_weigths: number of weight parameter matrix for all layers. + /// num_params_weights: number of weight parameter matrix for all layers. /// num_params_biases: number of bias parameter vector for all layers. /// weights: the canonical form of weights that can be used for saving /// and restoration. They are more likely to be compatible across different @@ -10346,7 +11088,7 @@ public TFOutput CudnnRNNParamsSize (TFOutput num_layers, TFOutput num_units, TFO /// 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 + /// is_training: Indicates whether this operation is used for inference or /// training. /// reserve_space: An opaque tensor that can be used in backprop calculation. It /// is only produced if is_training is true. @@ -10479,7 +11221,7 @@ public TFOutput CudnnRNNParamsSize (TFOutput num_layers, TFOutput num_units, TFO /// shape is [batch_size, seq_length, 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 + /// is_training: Indicates whether this operation is used for inference or /// training. /// time_major: Indicates whether the input/output format is time major or batch /// major. @@ -10795,7 +11537,7 @@ public TFOutput DataFormatDimMap (TFOutput x, string src_format = null, string d } /// - /// Returns the permuted vector/tensor in the destination data format given the + /// Permute input tensor from src_format to dst_format. /// /// /// Vector of size 4 or Tensor of shape (4, 2) in source data format. @@ -10816,7 +11558,26 @@ public TFOutput DataFormatDimMap (TFOutput x, string src_format = null, string d /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// /// - /// one in the source data format. + /// Input tensor must be a vector of size 4, or a 4x2 tensor. + /// + /// For example, with src_format of NHWC, dst_format of NCHW, and inputs: + /// + /// [1, 2, 3, 4] + /// + /// and + /// + /// [[1, 2, 3, 4], + /// [5, 6, 7, 8]] + /// + /// , the outputs will be (respectively): + /// + /// [1, 4, 2, 3] + /// + /// and + /// + /// [[1, 4, 2, 3], + /// [5, 8, 6, 7]] + /// /// public TFOutput DataFormatVecPermute (TFOutput x, string src_format = null, string dst_format = null, string operName = null) { @@ -10837,6 +11598,144 @@ public TFOutput DataFormatVecPermute (TFOutput x, string src_format = null, stri return y; } + /// + /// Creates a dataset that reads data from the tf.data service. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DataServiceDataset'. + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// + /// + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + public TFOutput DataServiceDataset (TFOutput dataset_id, TFOutput processing_mode, TFOutput address, TFOutput protocol, TFOutput job_name, TFOutput max_outstanding_requests, TFOutput iteration_counter, TFDataType[] output_types, TFShape[] output_shapes, long? task_refresh_interval_hint_ms = null, string data_transfer_protocol = null, string target_workers = null, string operName = null) + { + var desc = new TFOperationDesc (this, "DataServiceDataset", MakeName ("DataServiceDataset", operName)); + desc.AddInput (dataset_id); + desc.AddInput (processing_mode); + desc.AddInput (address); + desc.AddInput (protocol); + desc.AddInput (job_name); + desc.AddInput (max_outstanding_requests); + desc.AddInput (iteration_counter); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("output_types", output_types); + desc.SetAttrShape ("output_shapes", output_shapes); + if (task_refresh_interval_hint_ms.HasValue) + desc.SetAttr ("task_refresh_interval_hint_ms", task_refresh_interval_hint_ms.Value); + + if (data_transfer_protocol != null) + desc.SetAttr ("data_transfer_protocol", data_transfer_protocol); + + if (target_workers != null) + desc.SetAttr ("target_workers", target_workers); + + var op = desc.FinishOperation (); + int _idx = 0; + var handle = new TFOutput (op, _idx++); + return handle; + } + + /// + /// Creates a dataset that reads data from the tf.data service. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DataServiceDatasetV2'. + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// + /// + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + public TFOutput DataServiceDatasetV2 (TFOutput dataset_id, TFOutput processing_mode, TFOutput address, TFOutput protocol, TFOutput job_name, TFOutput consumer_index, TFOutput num_consumers, TFOutput max_outstanding_requests, TFOutput iteration_counter, TFDataType[] output_types, TFShape[] output_shapes, long? task_refresh_interval_hint_ms = null, string data_transfer_protocol = null, string target_workers = null, string operName = null) + { + var desc = new TFOperationDesc (this, "DataServiceDatasetV2", MakeName ("DataServiceDatasetV2", operName)); + desc.AddInput (dataset_id); + desc.AddInput (processing_mode); + desc.AddInput (address); + desc.AddInput (protocol); + desc.AddInput (job_name); + desc.AddInput (consumer_index); + desc.AddInput (num_consumers); + desc.AddInput (max_outstanding_requests); + desc.AddInput (iteration_counter); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("output_types", output_types); + desc.SetAttrShape ("output_shapes", output_shapes); + if (task_refresh_interval_hint_ms.HasValue) + desc.SetAttr ("task_refresh_interval_hint_ms", task_refresh_interval_hint_ms.Value); + + if (data_transfer_protocol != null) + desc.SetAttr ("data_transfer_protocol", data_transfer_protocol); + + if (target_workers != null) + desc.SetAttr ("target_workers", target_workers); + + var op = desc.FinishOperation (); + int _idx = 0; + var handle = new TFOutput (op, _idx++); + return handle; + } + /// /// Returns the cardinality of input_dataset. /// @@ -10908,6 +11807,12 @@ public TFOutput DatasetFromGraph (TFOutput graph_def, string operName = null) /// /// Optional argument /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// /// /// The graph representation of the dataset (as serialized GraphDef). /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. @@ -10915,7 +11820,7 @@ public TFOutput DatasetFromGraph (TFOutput graph_def, string operName = null) /// /// Returns a graph representation for input_dataset. /// - public TFOutput DatasetToGraph (TFOutput input_dataset, string[] stateful_whitelist = null, string operName = null) + public TFOutput DatasetToGraph (TFOutput input_dataset, string[] stateful_whitelist = null, bool? allow_stateful = null, bool? strip_device_assignment = null, string operName = null) { var desc = new TFOperationDesc (this, "DatasetToGraph", MakeName ("DatasetToGraph", operName)); desc.AddInput (input_dataset); @@ -10925,6 +11830,53 @@ public TFOutput DatasetToGraph (TFOutput input_dataset, string[] stateful_whitel if (stateful_whitelist != null) desc.SetAttr ("stateful_whitelist", stateful_whitelist); + if (allow_stateful.HasValue) + desc.SetAttr ("allow_stateful", allow_stateful.Value); + + if (strip_device_assignment.HasValue) + desc.SetAttr ("strip_device_assignment", strip_device_assignment.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var graph = new TFOutput (op, _idx++); + return graph; + } + + /// + /// 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 'DatasetToGraphV2'. + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// The graph representation of the dataset (as serialized GraphDef). + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Returns a graph representation for input_dataset. + /// + public TFOutput DatasetToGraphV2 (TFOutput input_dataset, long? external_state_policy = null, bool? strip_device_assignment = null, string operName = null) + { + var desc = new TFOperationDesc (this, "DatasetToGraphV2", MakeName ("DatasetToGraphV2", operName)); + desc.AddInput (input_dataset); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (external_state_policy.HasValue) + desc.SetAttr ("external_state_policy", external_state_policy.Value); + + if (strip_device_assignment.HasValue) + desc.SetAttr ("strip_device_assignment", strip_device_assignment.Value); + var op = desc.FinishOperation (); int _idx = 0; var graph = new TFOutput (op, _idx++); @@ -11090,7 +12042,6 @@ public TFOutput DebugGradientRefIdentity (TFOutput input, string operName = null /// them, the output will be an empty Tensor. /// /// - /// Output tensor that equals the input tensor. /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// /// @@ -11121,6 +12072,92 @@ public TFOutput DebugIdentity (TFOutput input, string device_name = null, string return output; } + /// + /// Debug Identity V2 Op. + /// + /// + /// Input tensor, non-Reference type + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DebugIdentityV2'. + /// + /// + /// Optional argument + /// A tfdbg-generated ID for the context that the op belongs to, + /// e.g., a concrete compiled tf.function. + /// + /// + /// Optional argument + /// Optional. Name of the op that the debug op is concerned with. + /// Used only for single-tensor trace. + /// + /// + /// Optional argument + /// Optional. Output slot index of the tensor that the debug op + /// is concerned with. Used only for single-tensor trace. + /// + /// + /// Optional argument + /// TensorDebugMode enum value. See debug_event.proto for details. + /// + /// + /// Optional argument + /// List of URLs to debug targets, e.g., file:///foo/tfdbg_dump. + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Provides an identity mapping from input to output, while writing the content of + /// the input tensor by calling DebugEventsWriter. + /// + /// The semantics of the input tensor depends on tensor_debug_mode. In typical + /// usage, the input tensor comes directly from the user computation only when + /// graph_debug_mode is FULL_TENSOR (see protobuf/debug_event.proto for a + /// list of all the possible values of graph_debug_mode). For the other debug modes, + /// the input tensor should be produced by an additional op or subgraph that + /// computes summary information about one or more tensors. + /// + public TFOutput DebugIdentityV2 (TFOutput input, string tfdbg_context_id = null, string op_name = null, long? output_slot = null, long? tensor_debug_mode = null, string[] debug_urls = null, long? circular_buffer_size = null, string tfdbg_run_id = null, string operName = null) + { + var desc = new TFOperationDesc (this, "DebugIdentityV2", MakeName ("DebugIdentityV2", operName)); + desc.AddInput (input); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (tfdbg_context_id != null) + desc.SetAttr ("tfdbg_context_id", tfdbg_context_id); + + if (op_name != null) + desc.SetAttr ("op_name", op_name); + + if (output_slot.HasValue) + desc.SetAttr ("output_slot", output_slot.Value); + + if (tensor_debug_mode.HasValue) + desc.SetAttr ("tensor_debug_mode", tensor_debug_mode.Value); + + if (debug_urls != null) + desc.SetAttr ("debug_urls", debug_urls); + + if (circular_buffer_size.HasValue) + desc.SetAttr ("circular_buffer_size", circular_buffer_size.Value); + + if (tfdbg_run_id != null) + desc.SetAttr ("tfdbg_run_id", tfdbg_run_id); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + /// /// Debug NaN Value Counter Op. /// @@ -11152,7 +12189,6 @@ public TFOutput DebugIdentity (TFOutput input, string device_name = null, string /// them, the output will be an empty Tensor. /// /// - /// An integer output tensor that is the number of NaNs in the input. /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// /// @@ -11230,40 +12266,13 @@ public TFOutput DebugNanCount (TFOutput input, string device_name = null, string /// 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 &lt;= 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 &gt; lower_bound and &lt; 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 &lt; upper_bound and &gt; 0. - /// [7]: generalized +inf count, elements &gt;= 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 TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// /// /// Provide a basic summary of numeric value types, range and distribution. /// /// output: 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: + /// 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 @@ -11273,7 +12282,7 @@ public TFOutput DebugNanCount (TFOutput input, string device_name = null, string /// -inf. Otherwise, this is the count of elements &gt; lower_bound and &lt; 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 &lt; upper_bound and &gt; 0. + /// +inf. Otherwise, this is the count of elements &lt; upper_bound and &gt; 0. /// [7]: generalized +inf count, elements &gt;= upper_bound. upper_bound is +inf by /// default. /// Output elements [1:8] are all zero, if the tensor is uninitialized. @@ -11325,6 +12334,110 @@ public TFOutput DebugNumericSummary (TFOutput input, string device_name = null, return output; } + /// + /// Debug Numeric Summary V2 Op. + /// + /// + /// Input tensor, to be summarized by the op. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DebugNumericSummaryV2'. + /// + /// + /// Optional argument + /// Optional. The type of the output. Can be float32 or float64 (default: float32). + /// + /// + /// Optional argument + /// Tensor debug mode: the mode in which the input tensor is summarized + /// by the op. See the TensorDebugMode enum in + /// tensorflow/core/protobuf/debug_event.proto for details. + /// + /// Supported values: + /// 2 (CURT_HEALTH): Output a float32/64 tensor of shape [2]. The 1st + /// element is the tensor_id, if provided, and -1 otherwise. The 2nd + /// element is a bit which is set to 1 if the input tensor has an + /// infinity or nan value, or zero otherwise. + /// + /// 3 (CONCISE_HEALTH): Output a float32/64 tensor of shape [5]. The 1st + /// element is the tensor_id, if provided, and -1 otherwise. The + /// remaining four slots are the total number of elements, -infs, + /// +infs, and nans in the input tensor respectively. + /// + /// 4 (FULL_HEALTH): Output a float32/64 tensor of shape [11]. The 1st + /// element is the tensor_id, if provided, and -1 otherwise. The 2nd + /// element is the device_id, if provided, and -1 otherwise. The 3rd + /// element holds the datatype value of the input tensor as according + /// to the enumerated type in tensorflow/core/framework/types.proto. + /// The remaining elements hold the total number of elements, -infs, + /// +infs, nans, negative finite numbers, zeros, and positive finite + /// numbers in the input tensor respectively. + /// + /// 5 (SHAPE): Output a float32/64 tensor of shape [10]. The 1st + /// element is the tensor_id, if provided, and -1 otherwise. The 2nd + /// element holds the datatype value of the input tensor as according + /// to the enumerated type in tensorflow/core/framework/types.proto. + /// The 3rd element holds the rank of the tensor. The 4th element holds + /// the number of elements within the tensor. Finally the remaining 6 + /// elements hold the shape of the tensor. If the rank of the tensor + /// is lower than 6, the shape is right padded with zeros. If the rank + /// is greater than 6, the head of the shape is truncated. + /// + /// 6 (FULL_NUMERICS): Output a float32/64 tensor of shape [22]. The 1st + /// element is the tensor_id, if provided, and -1 otherwise. The 2nd + /// element is the device_id, if provided, and -1 otherwise. The 3rd + /// element holds the datatype value of the input tensor as according + /// to the enumerated type in tensorflow/core/framework/types.proto. + /// The 4th element holds the rank of the tensor. The 5th to 11th + /// elements hold the shape of the tensor. If the rank of the tensor + /// is lower than 6, the shape is right padded with zeros. If the rank + /// is greater than 6, the head of the shape is truncated. The 12th to + /// 18th elements hold the number of elements, -infs, +infs, nans, + /// denormal floats, negative finite numbers, zeros, and positive + /// finite numbers in the input tensor respectively. The final four + /// elements hold the min value, max value, mean, and variance of the + /// input tensor. + /// + /// 8 (REDUCE_INF_NAN_THREE_SLOTS): Output a float32/64 tensor of shape + /// [3]. The 1st element is -inf if any elements of the input tensor + /// is -inf, or zero otherwise. The 2nd element is +inf if any elements + /// of the input tensor is +inf, or zero otherwise. The 3rd element is + /// nan if any element of the input tensor is nan, or zero otherwise. + /// + /// + /// Optional argument + /// Optional. An integer identifier for the tensor being summarized by this op. + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Computes a numeric summary of the input tensor. The shape of the output + /// depends on the tensor_debug_mode attribute. + /// This op is used internally by TensorFlow Debugger (tfdbg) v2. + /// + public TFOutput DebugNumericSummaryV2 (TFOutput input, TFDataType? output_dtype = null, long? tensor_debug_mode = null, long? tensor_id = null, string operName = null) + { + var desc = new TFOperationDesc (this, "DebugNumericSummaryV2", MakeName ("DebugNumericSummaryV2", operName)); + desc.AddInput (input); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (output_dtype.HasValue) + desc.SetAttrType ("output_dtype", output_dtype.Value); + + if (tensor_debug_mode.HasValue) + desc.SetAttr ("tensor_debug_mode", tensor_debug_mode.Value); + + if (tensor_id.HasValue) + desc.SetAttr ("tensor_id", tensor_id.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + /// /// Decode and Crop a JPEG-encoded image to a uint8 tensor. /// @@ -11439,8 +12552,9 @@ public TFOutput DecodeAndCropJpeg (TFOutput contents, TFOutput crop_window, long /// The TFOperation can be fetched from the resulting TFOutput, by fethching 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 /. + /// Input may or may not have padding at the end. See + /// [EncodeBase64](https://www.tensorflow.org/api_docs/python/tf/io/encode_base64) + /// for padding. Web-safe means that input must use - and _ instead of + and /. /// public TFOutput DecodeBase64 (TFOutput input, string operName = null) { @@ -11633,7 +12747,7 @@ public TFOutput[] DecodeCSV (TFOutput records, TFOutput[] record_defaults, strin /// convert $src.gif -coalesce $dst.gif /// /// This op also supports decoding JPEGs and PNGs, though it is cleaner to use - /// tf.image.decode_image. + /// tf.io.decode_image. /// public TFOutput DecodeGif (TFOutput contents, string operName = null) { @@ -11648,6 +12762,76 @@ public TFOutput DecodeGif (TFOutput contents, string operName = null) return image; } + /// + /// Function for decode_bmp, decode_gif, decode_jpeg, and decode_png. + /// + /// + /// 0-D. The encoded image bytes. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DecodeImage'. + /// + /// + /// Optional argument + /// Number of color channels for the decoded image. + /// + /// + /// Optional argument + /// The desired DType of the returned Tensor. + /// + /// + /// Optional argument + /// Controls the output shape of the returned op. If True, the returned op will + /// produce a 3-D tensor for PNG, JPEG, and BMP files; and a 4-D tensor for all + /// GIFs, whether animated or not. If, False, the returned op will produce a 3-D + /// tensor for all file types and will truncate animated GIFs to the first frame. + /// + /// + /// 3-D with shape [height, width, channels] or 4-D with shape + /// [frame, height, width, channels].. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Detects whether an image is a BMP, GIF, JPEG, or PNG, and performs the + /// appropriate operation to convert the input bytes string into a Tensor of type + /// dtype. + /// + /// *NOTE*: decode_gif returns a 4-D array [num_frames, height, width, 3], as + /// opposed to decode_bmp, decode_jpeg and decode_png, which return 3-D arrays + /// [height, width, num_channels]. Make sure to take this into account when + /// constructing your graph if you are intermixing GIF files with BMP, JPEG, and/or + /// PNG files. Alternately, set the expand_animations argument of this function to + /// False, in which case the op will return 3-dimensional tensors and will truncate + /// animated GIF files to the first frame. + /// + /// *NOTE*: If the first frame of an animated GIF does not occupy the entire + /// canvas (maximum frame width x maximum frame height), then it fills the + /// unoccupied areas (in the first frame) with zeros (black). For frames after the + /// first frame that does not occupy the entire canvas, it uses the previous + /// frame to fill the unoccupied areas. + /// + public TFOutput DecodeImage (TFOutput contents, long? channels = null, TFDataType? dtype = null, bool? expand_animations = null, string operName = null) + { + var desc = new TFOperationDesc (this, "DecodeImage", MakeName ("DecodeImage", operName)); + desc.AddInput (contents); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (channels.HasValue) + desc.SetAttr ("channels", channels.Value); + + if (dtype.HasValue) + desc.SetAttrType ("dtype", dtype.Value); + + if (expand_animations.HasValue) + desc.SetAttr ("expand_animations", expand_animations.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var image = new TFOutput (op, _idx++); + return image; + } + /// /// Decode a JPEG-encoded image to a uint8 tensor. /// @@ -11711,7 +12895,7 @@ public TFOutput DecodeGif (TFOutput contents, string operName = null) /// /// /// 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. + /// the same, though it is cleaner to use tf.io.decode_image. /// public TFOutput DecodeJpeg (TFOutput contents, long? channels = null, long? ratio = null, bool? fancy_upscaling = null, bool? try_recover_truncated = null, float? acceptable_fraction = null, string dct_method = null, string operName = null) { @@ -11760,12 +12944,15 @@ public TFOutput DecodeJpeg (TFOutput contents, long? channels = null, long? rati /// The TFOperation can be fetched from the resulting TFOutput, by fethching 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. + /// + /// Note: This is **not** a general purpose JSON parsing op. + /// + /// This op converts JSON-serialized + /// tf.train.Example (created with json_format.MessageToJson, following the + /// [standard JSON mapping](https://developers.google.com/protocol-buffers/docs/proto3#json)) + /// to a binary-serialized tf.train.Example (equivalent to + /// Example.SerializeToString()) suitable for conversion to tensors with + /// tf.io.parse_example. /// public TFOutput DecodeJSONExample (TFOutput json_examples, string operName = null) { @@ -11859,7 +13046,7 @@ public TFOutput DecodePaddedRaw (TFOutput input_bytes, TFOutput fixed_length, TF /// 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. + /// is the same, though it is cleaner to use tf.io.decode_image. /// public TFOutput DecodePng (TFOutput contents, long? channels = null, TFDataType? dtype = null, string operName = null) { @@ -11923,6 +13110,10 @@ public TFOutput DecodePng (TFOutput contents, long? channels = null, TFDataType? /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. /// /// + /// Note: This API is designed for orthogonality rather than human-friendliness. It + /// can be used to parse input protos by hand, but it is intended for use in + /// generated code. + /// /// 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. @@ -11954,6 +13145,14 @@ public TFOutput DecodePng (TFOutput contents, long? channels = null, TFDataType? /// DT_INT64, or using twos-complement if the caller specifies DT_INT32 in /// the output_types attribute. /// + /// - map fields are not directly decoded. They are treated as repeated fields, + /// of the appropriate entry type. The proto-compiler defines entry types for each + /// map field. The type-name is the field name, converted to "CamelCase" with + /// "Entry" appended. The tf.train.Features.FeatureEntry message is an example of + /// one of these implicit Entry types. + /// + /// - enum fields should be read as int32. + /// /// Both binary and text proto serializations are supported, and can be /// chosen using the format attribute. /// @@ -12209,6 +13408,146 @@ public TFOperation DeleteSessionTensor (TFOutput handle, string operName = null) return op; } + /// + /// Counts the number of occurrences of each value in an integer array. + /// + /// + /// 1D or 2D int Tensor. + /// + /// + /// non-negative int 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 'DenseBincount'. + /// + /// + /// Optional argument + /// bool; Whether the kernel should count the appearance or number of occurrences. + /// + /// + /// 1D Tensor with length equal to size or 2D Tensor with [batch_size, size]. + /// The counts or summed weights for each value in the range [0, size). + /// The TFOperation can be fetched from the resulting TFOutput, by fethching 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 TFOutput DenseBincount (TFOutput input, TFOutput size, TFOutput weights, bool? binary_output = null, string operName = null) + { + var desc = new TFOperationDesc (this, "DenseBincount", MakeName ("DenseBincount", operName)); + desc.AddInput (input); + desc.AddInput (size); + desc.AddInput (weights); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (binary_output.HasValue) + desc.SetAttr ("binary_output", binary_output.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + + /// + /// Performs sparse-output bin counting for a tf.tensor input. + /// + /// + /// Tensor containing data to count. + /// + /// + /// A Tensor of the same shape as indices containing per-index weight values. May + /// also be the empty tensor if no weights are used. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DenseCountSparseOutput'. + /// + /// + /// Optional argument + /// Minimum value to count. Can be set to -1 for no minimum. + /// + /// + /// Optional argument + /// Maximum value to count. Can be set to -1 for no maximum. + /// + /// + /// Whether to output the number of occurrences of each value or 1. + /// + /// + /// Returns a tuple with multiple values, as follows: + /// output_indices: Indices tensor for the resulting sparse tensor object. + /// output_values: Values tensor for the resulting sparse tensor object. + /// output_dense_shape: Shape tensor for the resulting sparse tensor object. + /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. + /// + /// + /// Counts the number of times each value occurs in the input. + /// + public (TFOutput output_indices, TFOutput output_values, TFOutput output_dense_shape) DenseCountSparseOutput (TFOutput values, TFOutput weights, bool binary_output, long? minlength = null, long? maxlength = null, string operName = null) + { + var desc = new TFOperationDesc (this, "DenseCountSparseOutput", MakeName ("DenseCountSparseOutput", operName)); + desc.AddInput (values); + desc.AddInput (weights); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("binary_output", binary_output); + if (minlength.HasValue) + desc.SetAttr ("minlength", minlength.Value); + + if (maxlength.HasValue) + desc.SetAttr ("maxlength", maxlength.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var output_indices = new TFOutput (op, _idx++); + var output_values = new TFOutput (op, _idx++); + var output_dense_shape = new TFOutput (op, _idx++); + return (output_indices, output_values, output_dense_shape); + } + + /// + /// Converts a dense tensor to a (possibly batched) CSRSparseMatrix. + /// + /// + /// A Dense tensor. + /// + /// + /// Indices of nonzero elements. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DenseToCSRSparseMatrix'. + /// + /// + /// A (possibly batched) CSRSparseMatrix. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + public TFOutput DenseToCSRSparseMatrix (TFOutput dense_input, TFOutput indices, string operName = null) + { + var desc = new TFOperationDesc (this, "DenseToCSRSparseMatrix", MakeName ("DenseToCSRSparseMatrix", operName)); + desc.AddInput (dense_input); + desc.AddInput (indices); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var sparse_output = new TFOutput (op, _idx++); + return sparse_output; + } + /// /// Applies set operation along last dimension of 2 Tensor inputs. /// @@ -12519,6 +13858,9 @@ public TFOutput DepthToSpace (TFOutput input, long block_size, string data_forma /// /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DepthwiseConv2dNative'. /// + /// + /// Optional argument + /// /// /// Optional argument /// Specify the data format of the input and output data. With the @@ -12565,7 +13907,7 @@ public TFOutput DepthToSpace (TFOutput input, long block_size, string data_forma /// 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 TFOutput DepthwiseConv2dNative (TFOutput input, TFOutput filter, long[] strides, string padding, string data_format = null, long[] dilations = null, string operName = null) + public TFOutput DepthwiseConv2dNative (TFOutput input, TFOutput filter, long[] strides, string padding, long[] explicit_paddings = null, string data_format = null, long[] dilations = null, string operName = null) { var desc = new TFOperationDesc (this, "DepthwiseConv2dNative", MakeName ("DepthwiseConv2dNative", operName)); desc.AddInput (input); @@ -12575,6 +13917,9 @@ public TFOutput DepthwiseConv2dNative (TFOutput input, TFOutput filter, long[] s desc.SetAttr ("strides", strides); desc.SetAttr ("padding", padding); + if (explicit_paddings != null) + desc.SetAttr ("explicit_paddings", explicit_paddings); + if (data_format != null) desc.SetAttr ("data_format", data_format); @@ -12609,6 +13954,9 @@ public TFOutput DepthwiseConv2dNative (TFOutput input, TFOutput filter, long[] s /// /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DepthwiseConv2dNativeBackpropFilter'. /// + /// + /// Optional argument + /// /// /// Optional argument /// Specify the data format of the input and output data. With the @@ -12638,7 +13986,7 @@ public TFOutput DepthwiseConv2dNative (TFOutput input, TFOutput filter, long[] s /// the filter input of the convolution. /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// - public TFOutput DepthwiseConv2dNativeBackpropFilter (TFOutput input, TFOutput filter_sizes, TFOutput out_backprop, long[] strides, string padding, string data_format = null, long[] dilations = null, string operName = null) + public TFOutput DepthwiseConv2dNativeBackpropFilter (TFOutput input, TFOutput filter_sizes, TFOutput out_backprop, long[] strides, string padding, long[] explicit_paddings = null, string data_format = null, long[] dilations = null, string operName = null) { var desc = new TFOperationDesc (this, "DepthwiseConv2dNativeBackpropFilter", MakeName ("DepthwiseConv2dNativeBackpropFilter", operName)); desc.AddInput (input); @@ -12649,6 +13997,9 @@ public TFOutput DepthwiseConv2dNativeBackpropFilter (TFOutput input, TFOutput fi desc.SetAttr ("strides", strides); desc.SetAttr ("padding", padding); + if (explicit_paddings != null) + desc.SetAttr ("explicit_paddings", explicit_paddings); + if (data_format != null) desc.SetAttr ("data_format", data_format); @@ -12682,6 +14033,9 @@ public TFOutput DepthwiseConv2dNativeBackpropFilter (TFOutput input, TFOutput fi /// /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DepthwiseConv2dNativeBackpropInput'. /// + /// + /// Optional argument + /// /// /// Optional argument /// Specify the data format of the input and output data. With the @@ -12712,7 +14066,7 @@ public TFOutput DepthwiseConv2dNativeBackpropFilter (TFOutput input, TFOutput fi /// convolution. /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// - public TFOutput DepthwiseConv2dNativeBackpropInput (TFOutput input_sizes, TFOutput filter, TFOutput out_backprop, long[] strides, string padding, string data_format = null, long[] dilations = null, string operName = null) + public TFOutput DepthwiseConv2dNativeBackpropInput (TFOutput input_sizes, TFOutput filter, TFOutput out_backprop, long[] strides, string padding, long[] explicit_paddings = null, string data_format = null, long[] dilations = null, string operName = null) { var desc = new TFOperationDesc (this, "DepthwiseConv2dNativeBackpropInput", MakeName ("DepthwiseConv2dNativeBackpropInput", operName)); desc.AddInput (input_sizes); @@ -12723,6 +14077,9 @@ public TFOutput DepthwiseConv2dNativeBackpropInput (TFOutput input_sizes, TFOutp desc.SetAttr ("strides", strides); desc.SetAttr ("padding", padding); + if (explicit_paddings != null) + desc.SetAttr ("explicit_paddings", explicit_paddings); + if (data_format != null) desc.SetAttr ("data_format", data_format); @@ -12736,7 +14093,7 @@ public TFOutput DepthwiseConv2dNativeBackpropInput (TFOutput input_sizes, TFOutp } /// - /// Dequantize the 'input' tensor into a float Tensor. + /// Dequantize the 'input' tensor into a float or bfloat16 Tensor. /// /// /// @@ -12752,6 +14109,17 @@ public TFOutput DepthwiseConv2dNativeBackpropInput (TFOutput input_sizes, TFOutp /// /// Optional argument /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// Type of the output tensor. Currently Dequantize supports float and bfloat16. + /// If 'dtype' is 'bfloat16', it only supports 'MIN_COMBINED' mode. + /// /// /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// @@ -12809,7 +14177,7 @@ public TFOutput DepthwiseConv2dNativeBackpropInput (TFOutput input_sizes, TFOutp /// max_range / max_expected_T); /// /// - public TFOutput Dequantize (TFOutput input, TFOutput min_range, TFOutput max_range, string mode = null, string operName = null) + public TFOutput Dequantize (TFOutput input, TFOutput min_range, TFOutput max_range, string mode = null, bool? narrow_range = null, long? axis = null, TFDataType? dtype = null, string operName = null) { var desc = new TFOperationDesc (this, "Dequantize", MakeName ("Dequantize", operName)); desc.AddInput (input); @@ -12821,6 +14189,15 @@ public TFOutput Dequantize (TFOutput input, TFOutput min_range, TFOutput max_ran if (mode != null) desc.SetAttr ("mode", mode); + if (narrow_range.HasValue) + desc.SetAttr ("narrow_range", narrow_range.Value); + + if (axis.HasValue) + desc.SetAttr ("axis", axis.Value); + + if (dtype.HasValue) + desc.SetAttrType ("dtype", dtype.Value); + var op = desc.FinishOperation (); int _idx = 0; var output = new TFOutput (op, _idx++); @@ -13087,6 +14464,36 @@ public TFOutput DestroyTemporaryVariable (TFOutput reference, string var_name, s return value; } + /// + /// Return the index of device the op runs. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DeviceIndex'. + /// + /// + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Given a list of device names, this operation returns the index of the device + /// this op runs. The length of the list is returned in two cases: + /// (1) Device does not exist in the given device list. + /// (2) It is in XLA compilation. + /// + public TFOutput DeviceIndex (string[] device_names, string operName = null) + { + var desc = new TFOperationDesc (this, "DeviceIndex", MakeName ("DeviceIndex", operName)); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("device_names", device_names); + var op = desc.FinishOperation (); + int _idx = 0; + var index = new TFOutput (op, _idx++); + return index; + } + /// /// Returns a diagonal tensor with a given diagonal values. /// @@ -13383,6 +14790,9 @@ public TFOutput Dilation2DBackpropInput (TFOutput input, TFOutput filter, TFOutp /// /// If specified, the created operation in the graph will be this one, otherwise it will be named 'DirectedInterleaveDataset'. /// + /// + /// Optional argument + /// /// /// /// @@ -13390,7 +14800,7 @@ public TFOutput Dilation2DBackpropInput (TFOutput input, TFOutput filter, TFOutp /// /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// - public TFOutput DirectedInterleaveDataset (TFOutput selector_input_dataset, TFOutput[] data_input_datasets, TFDataType[] output_types, TFShape[] output_shapes, string operName = null) + public TFOutput DirectedInterleaveDataset (TFOutput selector_input_dataset, TFOutput[] data_input_datasets, TFDataType[] output_types, TFShape[] output_shapes, bool? stop_on_empty_dataset = null, string operName = null) { var desc = new TFOperationDesc (this, "DirectedInterleaveDataset", MakeName ("DirectedInterleaveDataset", operName)); desc.AddInput (selector_input_dataset); @@ -13400,6 +14810,9 @@ public TFOutput DirectedInterleaveDataset (TFOutput selector_input_dataset, TFOu desc.SetAttrType ("output_types", output_types); desc.SetAttrShape ("output_shapes", output_shapes); + if (stop_on_empty_dataset.HasValue) + desc.SetAttr ("stop_on_empty_dataset", stop_on_empty_dataset.Value); + var op = desc.FinishOperation (); int _idx = 0; var handle = new TFOutput (op, _idx++); @@ -13872,6 +15285,59 @@ public TFOutput EditDistance (TFOutput hypothesis_indices, TFOutput hypothesis_v return output; } + /// + /// Computes the eigen decomposition of one or more square matrices. + /// + /// + /// Tensor input of shape [N, N]. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Eig'. + /// + /// + /// Optional argument + /// If True then eigenvectors will be computed and returned in v. + /// Otherwise, only the eigenvalues will be computed. + /// + /// + /// + /// + /// Returns a tuple with multiple values, as follows: + /// e: Eigenvalues. Shape is [N]. + /// v: Eigenvectors. Shape is [N, N]. + /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. + /// + /// + /// Computes the eigenvalues and (optionally) right eigenvectors of each inner matrix in + /// input such that input[..., :, :] = v[..., :, :] * diag(e[..., :]). The eigenvalues + /// are sorted in non-decreasing order. + /// + /// + /// # a is a tensor. + /// # e is a tensor of eigenvalues. + /// # v is a tensor of eigenvectors. + /// e, v = eig(a) + /// e = eig(a, compute_v=False) + /// + /// + public (TFOutput e, TFOutput v) Eig (TFOutput input, TFDataType Tout, bool? compute_v = null, string operName = null) + { + var desc = new TFOperationDesc (this, "Eig", MakeName ("Eig", operName)); + desc.AddInput (input); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("Tout", Tout); + if (compute_v.HasValue) + desc.SetAttr ("compute_v", compute_v.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var e = new TFOutput (op, _idx++); + var v = new TFOutput (op, _idx++); + return (e, v); + } + /// /// Tensor contraction according to Einstein summation convention. /// @@ -13931,7 +15397,7 @@ public TFOutput EditDistance (TFOutput hypothesis_indices, TFOutput hypothesis_v /// Considering the batch matrix multiplication equation again /// (bij,bjk-&gt;bik), the contracted axis label is j. /// - /// (e) Expand Diagonal: If the output subcripts contain repeated (explicit) axis + /// (e) Expand Diagonal: If the output subscripts contain repeated (explicit) axis /// labels, the opposite operation of (a) is applied. For example, in the /// equation i-&gt;iii, and input shape [3], the output of shape [3, 3, 3] /// are all zeros, except for the (generalized) diagonal which is populated @@ -13939,7 +15405,7 @@ public TFOutput EditDistance (TFOutput hypothesis_indices, TFOutput hypothesis_v /// Note: This operation is not supported by np.einsum or tf.einsum; it is /// provided to enable computing the symbolic gradient of tf.einsum. /// - /// The output subcripts must contain only labels appearing in at least one of the + /// The output subscripts must contain only labels appearing in at least one of the /// input subscripts. Furthermore, all dimensions mapping to the same axis label /// must be equal. /// @@ -13951,7 +15417,7 @@ public TFOutput EditDistance (TFOutput hypothesis_indices, TFOutput hypothesis_v /// /// The broadcasted dimensions are placed in the corresponding location of the /// ellipsis in the output subscript. If the broadcasted dimensions are non-empty - /// and the output subcripts do not contain ellipsis, then an InvalidArgument error + /// and the output subscripts do not contain ellipsis, then an InvalidArgument error /// is raised. /// /// @compatibility(numpy) @@ -13981,7 +15447,7 @@ public TFOutput Einsum (TFOutput[] inputs, string equation, string operName = nu } /// - /// Computes exponential linear: exp(features) - 1 if &lt; 0, features otherwise. + /// Computes the exponential linear function. /// /// /// @@ -13992,6 +15458,20 @@ public TFOutput Einsum (TFOutput[] inputs, string equation, string operName = nu /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// /// + /// The ELU function is defined as: + /// + /// * $ e ^ x - 1 $ if $ x &lt; 0 $ + /// * $ x $ if $ x &gt;= 0 $ + /// + /// Examples: + /// + /// &gt;&gt;&gt; tf.nn.elu(1.0) + /// &lt;tf.Tensor: shape=(), dtype=float32, numpy=1.0&gt; + /// &gt;&gt;&gt; tf.nn.elu(0.0) + /// &lt;tf.Tensor: shape=(), dtype=float32, numpy=0.0&gt; + /// &gt;&gt;&gt; tf.nn.elu(-1000.0) + /// &lt;tf.Tensor: shape=(), dtype=float32, numpy=-1.0&gt; + /// /// See [Fast and Accurate Deep Network Learning by Exponential Linear Units (ELUs) /// ](http://arxiv.org/abs/1511.07289) /// @@ -14115,6 +15595,30 @@ public TFOutput EmptyTensorList (TFOutput element_shape, TFOutput max_num_elemen return handle; } + /// + /// Creates and returns an empty tensor map. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'EmptyTensorMap'. + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// handle: an empty tensor map + /// + public TFOutput EmptyTensorMap (string operName = null) + { + var desc = new TFOperationDesc (this, "EmptyTensorMap", MakeName ("EmptyTensorMap", operName)); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var handle = new TFOutput (op, _idx++); + return handle; + } + /// /// Encode strings into web-safe base64 format. /// @@ -14133,8 +15637,8 @@ public TFOutput EmptyTensorList (TFOutput element_shape, TFOutput max_num_elemen /// The TFOperation can be fetched from the resulting TFOutput, by fethching 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 + /// Refer to [this article](https://en.wikipedia.org/wiki/Base64) for more information on + /// base64 format. 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. /// @@ -14509,6 +16013,101 @@ public TFOperation EnqueueTPUEmbeddingIntegerBatch (TFOutput[] batch, TFOutput m return op; } + /// + /// Eases the porting of code that uses tf.nn.embedding_lookup(). + /// + /// + /// A list of rank 1 Tensors specifying the break points for splitting + /// embedding_indices and aggregation_weights into rows. + /// It corresponds to ids.row_splits in embedding_lookup(), when ids is a + /// RaggedTensor. + /// + /// + /// A list of rank 1 Tensors, indices into the embedding tables. + /// It corresponds to ids.values in embedding_lookup(), when ids is a RaggedTensor. + /// + /// + /// A list of rank 1 Tensors containing per training example + /// aggregation weights. It corresponds to the values field of a RaggedTensor + /// with the same row_splits as ids in embedding_lookup(), when ids is a + /// RaggedTensor. + /// + /// + /// A string input that overrides the mode specified in the + /// TPUEmbeddingConfiguration. Supported values are {'unspecified', 'inference', + /// 'training', 'backward_pass_only'}. When set to 'unspecified', the mode set + /// in TPUEmbeddingConfiguration is used, otherwise mode_override is used. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'EnqueueTPUEmbeddingRaggedTensorBatch'. + /// + /// + /// Optional argument + /// The TPU device to use. Should be &gt;= 0 and less than the number + /// of TPU cores in the task on which the node is placed. + /// + /// + /// Optional argument + /// A list of string scalars, one for each embedding table that specify + /// how to normalize the embedding activations after weighted summation. + /// Supported combiners are 'mean', 'sum', or 'sqrtn'. It is invalid to have + /// the sum of the weights be 0 for 'mean' or the sum of the squared weights be + /// 0 for 'sqrtn'. If combiners isn't passed, the default is to use 'sum' for + /// all tables. + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// A list of integers specifying the identifier of the embedding table + /// (offset of TableDescriptor in the TPUEmbeddingConfiguration) to lookup the + /// corresponding input. The ith input is looked up using table_ids[i]. The size + /// of the table_ids list must be equal to that of sample_indices, + /// embedding_indices and aggregation_weights. + /// + /// + /// Returns the description of the operation + /// + /// + /// sample_splits[i], embedding_indices[i] and aggregation_weights[i] correspond + /// to the ith feature. table_ids[i] indicates which embedding table to look up ith + /// feature. + /// + /// The tensors at corresponding positions in two of the input lists, + /// embedding_indices and aggregation_weights, must have the same shape, i.e. rank 1 + /// with dim_size() equal to the total number of lookups into the table described by + /// the corresponding feature. + /// + public TFOperation EnqueueTPUEmbeddingRaggedTensorBatch (TFOutput[] sample_splits, TFOutput[] embedding_indices, TFOutput[] aggregation_weights, TFOutput mode_override, long[] table_ids, long? device_ordinal = null, string[] combiners = null, long[] max_sequence_lengths = null, long[] num_features = null, string operName = null) + { + var desc = new TFOperationDesc (this, "EnqueueTPUEmbeddingRaggedTensorBatch", MakeName ("EnqueueTPUEmbeddingRaggedTensorBatch", operName)); + desc.AddInputs (sample_splits); + desc.AddInputs (embedding_indices); + desc.AddInputs (aggregation_weights); + desc.AddInput (mode_override); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("table_ids", table_ids); + if (device_ordinal.HasValue) + desc.SetAttr ("device_ordinal", device_ordinal.Value); + + if (combiners != null) + desc.SetAttr ("combiners", combiners); + + if (max_sequence_lengths != null) + desc.SetAttr ("max_sequence_lengths", max_sequence_lengths); + + if (num_features != null) + desc.SetAttr ("num_features", num_features); + + var op = desc.FinishOperation (); + return op; + } + /// /// An op that enqueues TPUEmbedding input indices from a SparseTensor. /// @@ -14626,6 +16225,9 @@ public TFOperation EnqueueTPUEmbeddingSparseBatch (TFOutput[] sample_indices, TF /// /// Optional argument /// + /// + /// Optional argument + /// /// /// A list of integers specifying the identifier of the embedding table /// (offset of TableDescriptor in the TPUEmbeddingConfiguration) to lookup the @@ -14646,7 +16248,7 @@ public TFOperation EnqueueTPUEmbeddingSparseBatch (TFOutput[] sample_indices, TF /// with dim_size() equal to the total number of lookups into the table described by /// the corresponding feature. /// - public TFOperation EnqueueTPUEmbeddingSparseTensorBatch (TFOutput[] sample_indices, TFOutput[] embedding_indices, TFOutput[] aggregation_weights, TFOutput mode_override, long[] table_ids, long? device_ordinal = null, string[] combiners = null, long[] max_sequence_lengths = null, string operName = null) + public TFOperation EnqueueTPUEmbeddingSparseTensorBatch (TFOutput[] sample_indices, TFOutput[] embedding_indices, TFOutput[] aggregation_weights, TFOutput mode_override, long[] table_ids, long? device_ordinal = null, string[] combiners = null, long[] max_sequence_lengths = null, long[] num_features = null, string operName = null) { var desc = new TFOperationDesc (this, "EnqueueTPUEmbeddingSparseTensorBatch", MakeName ("EnqueueTPUEmbeddingSparseTensorBatch", operName)); desc.AddInputs (sample_indices); @@ -14666,6 +16268,9 @@ public TFOperation EnqueueTPUEmbeddingSparseTensorBatch (TFOutput[] sample_indic if (max_sequence_lengths != null) desc.SetAttr ("max_sequence_lengths", max_sequence_lengths); + if (num_features != null) + desc.SetAttr ("num_features", num_features); + var op = desc.FinishOperation (); return op; } @@ -14803,7 +16408,7 @@ public TFOutput Equal (TFOutput x, TFOutput y, bool? incompatible_shape_error = } /// - /// Computes the Gauss error function of x element-wise. + /// Computes the [Gauss error function](https://en.wikipedia.org/wiki/Error_function) of x element-wise. In statistics, for non-negative values of $x$, the error function has the following interpretation: for a random variable $Y$ that is normally distributed with mean 0 and variance $1/\sqrt{2}$, $erf(x)$ is the probability that $Y$ falls in the range $[-x, x]$. /// /// /// @@ -15054,6 +16659,9 @@ public TFOutput ExpandDims (TFOutput input, TFOutput dim, string operName = null /// /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ExperimentalAutoShardDataset'. /// + /// + /// Optional argument + /// /// /// /// @@ -15070,7 +16678,7 @@ public TFOutput ExpandDims (TFOutput input, TFOutput dim, string operName = null /// This dataset will throw a NotFound error if we cannot shard the dataset /// automatically. /// - public TFOutput ExperimentalAutoShardDataset (TFOutput input_dataset, TFOutput num_workers, TFOutput index, TFDataType[] output_types, TFShape[] output_shapes, string operName = null) + public TFOutput ExperimentalAutoShardDataset (TFOutput input_dataset, TFOutput num_workers, TFOutput index, TFDataType[] output_types, TFShape[] output_shapes, long? auto_shard_policy = null, string operName = null) { var desc = new TFOperationDesc (this, "ExperimentalAutoShardDataset", MakeName ("ExperimentalAutoShardDataset", operName)); desc.AddInput (input_dataset); @@ -15081,6 +16689,9 @@ public TFOutput ExperimentalAutoShardDataset (TFOutput input_dataset, TFOutput n desc.SetAttrType ("output_types", output_types); desc.SetAttrShape ("output_shapes", output_shapes); + if (auto_shard_policy.HasValue) + desc.SetAttr ("auto_shard_policy", auto_shard_policy.Value); + var op = desc.FinishOperation (); int _idx = 0; var handle = new TFOutput (op, _idx++); @@ -15269,6 +16880,9 @@ public TFOutput ExperimentalDirectedInterleaveDataset (TFOutput selector_input_d /// /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ExperimentalIgnoreErrorsDataset'. /// + /// + /// Optional argument + /// /// /// /// @@ -15276,7 +16890,7 @@ public TFOutput ExperimentalDirectedInterleaveDataset (TFOutput selector_input_d /// /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// - public TFOutput ExperimentalIgnoreErrorsDataset (TFOutput input_dataset, TFDataType[] output_types, TFShape[] output_shapes, string operName = null) + public TFOutput ExperimentalIgnoreErrorsDataset (TFOutput input_dataset, TFDataType[] output_types, TFShape[] output_shapes, bool? log_warning = null, string operName = null) { var desc = new TFOperationDesc (this, "ExperimentalIgnoreErrorsDataset", MakeName ("ExperimentalIgnoreErrorsDataset", operName)); desc.AddInput (input_dataset); @@ -15285,6 +16899,9 @@ public TFOutput ExperimentalIgnoreErrorsDataset (TFOutput input_dataset, TFDataT desc.SetAttrType ("output_types", output_types); desc.SetAttrShape ("output_shapes", output_shapes); + if (log_warning.HasValue) + desc.SetAttr ("log_warning", log_warning.Value); + var op = desc.FinishOperation (); int _idx = 0; var handle = new TFOutput (op, _idx++); @@ -15938,7 +17555,7 @@ public TFOutput Expm1 (TFOutput x, string operName = null) /// /// Optional argument /// indicates if the noise should uniform, gaussian, or - /// zero. The default is uniform which means the the noise type + /// zero. The default is uniform which means the noise type /// will be decided by uniform_noise. /// /// @@ -15996,6 +17613,101 @@ public TFOutput ExtractGlimpse (TFOutput input, TFOutput size, TFOutput offsets, return glimpse; } + /// + /// 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 'ExtractGlimpseV2'. + /// + /// + /// Optional argument + /// 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. + /// + /// + /// Optional argument + /// indicates if the offset coordinates are normalized. + /// + /// + /// Optional argument + /// indicates if the noise should be generated using a + /// uniform distribution or a Gaussian distribution. + /// + /// + /// Optional argument + /// indicates if the noise should uniform, gaussian, or + /// zero. The default is uniform which means the noise type + /// will be decided by uniform_noise. + /// + /// + /// A tensor representing the glimpses [batch_size, + /// glimpse_height, glimpse_width, channels]. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching 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 TFOutput ExtractGlimpseV2 (TFOutput input, TFOutput size, TFOutput offsets, bool? centered = null, bool? normalized = null, bool? uniform_noise = null, string noise = null, string operName = null) + { + var desc = new TFOperationDesc (this, "ExtractGlimpseV2", MakeName ("ExtractGlimpseV2", operName)); + desc.AddInput (input); + desc.AddInput (size); + desc.AddInput (offsets); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (centered.HasValue) + desc.SetAttr ("centered", centered.Value); + + if (normalized.HasValue) + desc.SetAttr ("normalized", normalized.Value); + + if (uniform_noise.HasValue) + desc.SetAttr ("uniform_noise", uniform_noise.Value); + + if (noise != null) + desc.SetAttr ("noise", noise); + + var op = desc.FinishOperation (); + int _idx = 0; + var glimpse = new TFOutput (op, _idx++); + return glimpse; + } + /// /// Extract patches from images and put them in the "depth" output dimension. /// @@ -16085,7 +17797,7 @@ public TFOutput ExtractJpegShape (TFOutput contents, TFDataType? output_type = n } /// - /// Extract patches from input and put them in the "depth" output dimension. 3D extension of extract_image_patches. + /// Extract patches from input and put them in the "depth" output dimension. 3D extension of extract_image_patches. /// /// /// 5-D Tensor with shape [batch, in_planes, in_rows, in_cols, depth]. @@ -16103,7 +17815,7 @@ public TFOutput ExtractJpegShape (TFOutput contents, TFDataType? output_type = n /// /// The type of padding algorithm to use. /// - /// We specify the size-related attributes as: + /// The size-related attributes are specified as follows: /// /// /// ksizes = [1, ksize_planes, ksize_rows, ksize_cols, 1] @@ -16213,19 +17925,23 @@ public TFOutput FakeParam (TFDataType dtype, TFShape shape, string operName = nu /// The TFOperation can be fetched from the resulting TFOutput, by fethching 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. + /// 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. /// /// Before quantization, min and max values are adjusted with the following /// logic. /// It is suggested to have min &lt;= 0 &lt;= max. If 0 is not in the range of values, /// the behavior can be unexpected: - /// If 0 &lt; min &lt; max: min_adj = 0 and max_adj = max - min. - /// If min &lt; max &lt; 0: min_adj = min - max and max_adj = 0. - /// If min &lt;= 0 &lt;= max: scale = (max - min) / (2^num_bits - 1) , + /// + /// * If 0 &lt; min &lt; max: min_adj = 0 and max_adj = max - min. + /// * If min &lt; max &lt; 0: min_adj = min - max and max_adj = 0. + /// * If min &lt;= 0 &lt;= max: scale = (max - min) / (2^num_bits - 1) , /// min_adj = scale * round(min / scale) and max_adj = max + min_adj - min. /// /// Quantization is called fake since the output is still in floating point. @@ -16311,7 +18027,7 @@ public TFOutput FakeQuantWithMinMaxArgsGradient (TFOutput gradients, TFOutput in } /// - /// Fake-quantize the 'inputs' tensor of type float via global float scalars min + /// Fake-quantize the 'inputs' tensor of type float via global float scalars /// /// /// @@ -16332,21 +18048,26 @@ public TFOutput FakeQuantWithMinMaxArgsGradient (TFOutput gradients, TFOutput in /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// /// - /// and max to 'outputs' tensor of same shape as inputs. + /// Fake-quantize the inputs tensor of type float via global float scalars + /// min and max to outputs tensor of same shape as inputs. + /// + /// 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. + /// * [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. /// /// Before quantization, min and max values are adjusted with the following /// logic. /// It is suggested to have min &lt;= 0 &lt;= max. If 0 is not in the range of values, /// the behavior can be unexpected: - /// If 0 &lt; min &lt; max: min_adj = 0 and max_adj = max - min. - /// If min &lt; max &lt; 0: min_adj = min - max and max_adj = 0. - /// If min &lt;= 0 &lt;= max: scale = (max - min) / (2^num_bits - 1) , + /// + /// * If 0 &lt; min &lt; max: min_adj = 0 and max_adj = max - min. + /// * If min &lt; max &lt; 0: min_adj = min - max and max_adj = 0. + /// * If min &lt;= 0 &lt;= max: scale = (max - min) / (2^num_bits - 1) , /// min_adj = scale * round(min / scale) and max_adj = max + min_adj - min. /// /// This operation has a gradient and thus allows for training min and max @@ -16433,7 +18154,7 @@ public TFOutput FakeQuantWithMinMaxVars (TFOutput inputs, TFOutput min, TFOutput } /// - /// Fake-quantize the 'inputs' tensor of type float and one of the shapes: [d], + /// Fake-quantize the 'inputs' tensor of type float via per-channel floats /// /// /// @@ -16454,22 +18175,27 @@ public TFOutput FakeQuantWithMinMaxVars (TFOutput inputs, TFOutput min, TFOutput /// The TFOperation can be fetched from the resulting TFOutput, by fethching 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. + /// Fake-quantize the inputs tensor of type float per-channel and one of the + /// shapes: [d], [b, d] [b, h, w, d] via per-channel floats min and max + /// of shape [d] to outputs tensor of same shape as inputs. + /// + /// 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. + /// * [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. /// /// Before quantization, min and max values are adjusted with the following /// logic. /// It is suggested to have min &lt;= 0 &lt;= max. If 0 is not in the range of values, /// the behavior can be unexpected: - /// If 0 &lt; min &lt; max: min_adj = 0 and max_adj = max - min. - /// If min &lt; max &lt; 0: min_adj = min - max and max_adj = 0. - /// If min &lt;= 0 &lt;= max: scale = (max - min) / (2^num_bits - 1) , + /// + /// * If 0 &lt; min &lt; max: min_adj = 0 and max_adj = max - min. + /// * If min &lt; max &lt; 0: min_adj = min - max and max_adj = 0. + /// * If min &lt;= 0 &lt;= max: scale = (max - min) / (2^num_bits - 1) , /// min_adj = scale * round(min / scale) and max_adj = max + min_adj - min. /// /// This operation has a gradient and thus allows for training min and max @@ -16891,6 +18617,43 @@ public TFOutput FilterByLastComponentDataset (TFOutput input_dataset, TFDataType return output; } + /// + /// Creates a dataset by applying tf.data.Options to input_dataset. + /// + /// + /// A variant tensor representing the input dataset. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'FinalizeDataset'. + /// + /// + /// Optional argument + /// + /// + /// + /// + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + public TFOutput FinalizeDataset (TFOutput input_dataset, TFDataType[] output_types, TFShape[] output_shapes, bool? has_captured_ref = null, string operName = null) + { + var desc = new TFOperationDesc (this, "FinalizeDataset", MakeName ("FinalizeDataset", operName)); + desc.AddInput (input_dataset); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("output_types", output_types); + desc.SetAttrShape ("output_shapes", output_shapes); + if (has_captured_ref.HasValue) + desc.SetAttr ("has_captured_ref", has_captured_ref.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var handle = new TFOutput (op, _idx++); + return handle; + } + /// /// Generates fingerprint values. /// @@ -17738,6 +19501,9 @@ public TFOutput FractionalMaxPoolGrad (TFOutput orig_input, TFOutput orig_output /// Optional argument /// A small float number added to the variance of x. /// + /// + /// Optional argument + /// /// /// Optional argument /// The data format for x and y. Either "NHWC" (default) or "NCHW". @@ -17764,7 +19530,7 @@ public TFOutput FractionalMaxPoolGrad (TFOutput orig_input, TFOutput orig_output /// Note that the size of 4D Tensors are defined by either "NHWC" or "NCHW". /// The size of 1D Tensors matches the dimension C of the 4D Tensors. /// - public (TFOutput y, TFOutput batch_mean, TFOutput batch_variance, TFOutput reserve_space_1, TFOutput reserve_space_2) FusedBatchNorm (TFOutput x, TFOutput scale, TFOutput offset, TFOutput mean, TFOutput variance, float? epsilon = null, string data_format = null, bool? is_training = null, string operName = null) + public (TFOutput y, TFOutput batch_mean, TFOutput batch_variance, TFOutput reserve_space_1, TFOutput reserve_space_2) FusedBatchNorm (TFOutput x, TFOutput scale, TFOutput offset, TFOutput mean, TFOutput variance, float? epsilon = null, float? exponential_avg_factor = null, string data_format = null, bool? is_training = null, string operName = null) { var desc = new TFOperationDesc (this, "FusedBatchNorm", MakeName ("FusedBatchNorm", operName)); desc.AddInput (x); @@ -17778,6 +19544,9 @@ public TFOutput FractionalMaxPoolGrad (TFOutput orig_input, TFOutput orig_output if (epsilon.HasValue) desc.SetAttr ("epsilon", epsilon.Value); + if (exponential_avg_factor.HasValue) + desc.SetAttr ("exponential_avg_factor", exponential_avg_factor.Value); + if (data_format != null) desc.SetAttr ("data_format", data_format); @@ -18085,6 +19854,9 @@ public TFOutput FractionalMaxPoolGrad (TFOutput orig_input, TFOutput orig_output /// Optional argument /// A small float number added to the variance of x. /// + /// + /// Optional argument + /// /// /// Optional argument /// The data format for x and y. Either "NHWC" (default) or "NCHW". @@ -18111,7 +19883,7 @@ public TFOutput FractionalMaxPoolGrad (TFOutput orig_input, TFOutput orig_output /// Note that the size of 4D Tensors are defined by either "NHWC" or "NCHW". /// The size of 1D Tensors matches the dimension C of the 4D Tensors. /// - public (TFOutput y, TFOutput batch_mean, TFOutput batch_variance, TFOutput reserve_space_1, TFOutput reserve_space_2) FusedBatchNormV2 (TFOutput x, TFOutput scale, TFOutput offset, TFOutput mean, TFOutput variance, float? epsilon = null, string data_format = null, bool? is_training = null, string operName = null) + public (TFOutput y, TFOutput batch_mean, TFOutput batch_variance, TFOutput reserve_space_1, TFOutput reserve_space_2) FusedBatchNormV2 (TFOutput x, TFOutput scale, TFOutput offset, TFOutput mean, TFOutput variance, float? epsilon = null, float? exponential_avg_factor = null, string data_format = null, bool? is_training = null, string operName = null) { var desc = new TFOperationDesc (this, "FusedBatchNormV2", MakeName ("FusedBatchNormV2", operName)); desc.AddInput (x); @@ -18125,6 +19897,9 @@ public TFOutput FractionalMaxPoolGrad (TFOutput orig_input, TFOutput orig_output if (epsilon.HasValue) desc.SetAttr ("epsilon", epsilon.Value); + if (exponential_avg_factor.HasValue) + desc.SetAttr ("exponential_avg_factor", exponential_avg_factor.Value); + if (data_format != null) desc.SetAttr ("data_format", data_format); @@ -18168,6 +19943,9 @@ public TFOutput FractionalMaxPoolGrad (TFOutput orig_input, TFOutput orig_output /// Optional argument /// A small float number added to the variance of x. /// + /// + /// Optional argument + /// /// /// Optional argument /// The data format for x and y. Either "NHWC" (default) or "NCHW". @@ -18196,7 +19974,7 @@ public TFOutput FractionalMaxPoolGrad (TFOutput orig_input, TFOutput orig_output /// Note that the size of 4D Tensors are defined by either "NHWC" or "NCHW". /// The size of 1D Tensors matches the dimension C of the 4D Tensors. /// - public (TFOutput y, TFOutput batch_mean, TFOutput batch_variance, TFOutput reserve_space_1, TFOutput reserve_space_2, TFOutput reserve_space_3) FusedBatchNormV3 (TFOutput x, TFOutput scale, TFOutput offset, TFOutput mean, TFOutput variance, float? epsilon = null, string data_format = null, bool? is_training = null, string operName = null) + public (TFOutput y, TFOutput batch_mean, TFOutput batch_variance, TFOutput reserve_space_1, TFOutput reserve_space_2, TFOutput reserve_space_3) FusedBatchNormV3 (TFOutput x, TFOutput scale, TFOutput offset, TFOutput mean, TFOutput variance, float? epsilon = null, float? exponential_avg_factor = null, string data_format = null, bool? is_training = null, string operName = null) { var desc = new TFOperationDesc (this, "FusedBatchNormV3", MakeName ("FusedBatchNormV3", operName)); desc.AddInput (x); @@ -18210,6 +19988,9 @@ public TFOutput FractionalMaxPoolGrad (TFOutput orig_input, TFOutput orig_output if (epsilon.HasValue) desc.SetAttr ("epsilon", epsilon.Value); + if (exponential_avg_factor.HasValue) + desc.SetAttr ("exponential_avg_factor", exponential_avg_factor.Value); + if (data_format != null) desc.SetAttr ("data_format", data_format); @@ -18583,8 +20364,8 @@ public TFOutput GatherNd (TFOutput parameters, TFOutput indices, string operName /// /// /// indices must be an integer tensor of any dimension (usually 0-D or 1-D). - /// Produces an output tensor with shape params.shape[:axis] + indices.shape + - /// params.shape[axis + 1:] where: + /// Produces an output tensor with shape params.shape[:axis] + + /// indices.shape[batch_dims:] + params.shape[axis + 1:] where: /// /// /// # Scalar indices (output is rank(params) - 1). @@ -18629,146 +20410,79 @@ public TFOutput GatherV2 (TFOutput parameters, TFOutput indices, TFOutput axis, } /// - /// Re-configures the GCS block cache with the new configuration values. + /// This op produces Region of Interests from given bounding boxes(bbox_deltas) encoded wrt anchors according to eq.2 in arXiv:1506.01497 /// - /// + /// + /// A 4-D float tensor of shape [num_images, height, width, num_achors] containing scores of the boxes for given anchors, can be unsorted. /// - /// + /// + /// A 4-D float tensor of shape [num_images, height, width, 4 x num_anchors]. encoding boxes with respec to each anchor. + /// Coordinates are given in the form [dy, dx, dh, dw]. /// - /// + /// + /// A 2-D float tensor of shape [num_images, 5] containing image information Height, Width, Scale. /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'GcsConfigureBlockCache'. + /// + /// A 2-D float tensor of shape [num_anchors, 4] describing the anchor boxes. Boxes are formatted in the form [y1, x1, y2, x2]. /// - /// - /// Returns the description of the operation - /// - /// - /// If the values are the same as already configured values, this op is a no-op. If - /// they are different, the current contents of the block cache is dropped, and a - /// new block cache is created fresh. - /// - public TFOperation GcsConfigureBlockCache (TFOutput max_cache_size, TFOutput block_size, TFOutput max_staleness, string operName = null) - { - var desc = new TFOperationDesc (this, "GcsConfigureBlockCache", MakeName ("GcsConfigureBlockCache", operName)); - desc.AddInput (max_cache_size); - desc.AddInput (block_size); - desc.AddInput (max_staleness); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - var op = desc.FinishOperation (); - return op; - } - - /// - /// Configures the credentials used by the GCS client of the local TF runtime. - /// - /// + /// + /// A scalar float tensor for non-maximal-suppression threshold. /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'GcsConfigureCredentials'. + /// + /// A scalar int tensor for the number of top scoring boxes to be used as input. + /// + /// + /// A scalar float tensor. Any box that has a smaller size than min_size will be discarded. /// - /// - /// Returns the description of the operation - /// - /// - /// The json input can be of the format: - /// - /// 1. Refresh Token: - /// { - /// "client_id": "&lt;redacted&gt;", - /// "client_secret": "&lt;redacted&gt;", - /// "refresh_token: "&lt;redacted&gt;", - /// "type": "authorized_user", - /// } - /// - /// 2. Service Account: - /// { - /// "type": "service_account", - /// "project_id": "&lt;redacted&gt;", - /// "private_key_id": "&lt;redacted&gt;", - /// "private_key": "------BEGIN PRIVATE KEY-----\n&lt;REDACTED&gt;\n-----END PRIVATE KEY------\n", - /// "client_email": "&lt;REDACTED&gt;@&lt;REDACTED&gt;.iam.gserviceaccount.com", - /// "client_id": "&lt;REDACTED&gt;", - /// # Some additional fields elided - /// } - /// - /// Note the credentials established through this method are shared across all - /// sessions run on this runtime. - /// - /// Note be sure to feed the inputs to this op to ensure the credentials are not - /// stored in a constant op within the graph that might accidentally be checkpointed - /// or in other ways be persisted or exfiltrated. - /// - public TFOperation GcsConfigureCredentials (TFOutput json, string operName = null) - { - var desc = new TFOperationDesc (this, "GcsConfigureCredentials", MakeName ("GcsConfigureCredentials", operName)); - desc.AddInput (json); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - var op = desc.FinishOperation (); - return op; - } - - /// - /// Generates serialized partition messages suitable for batch reads. - /// /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'GenerateBigQueryReaderPartitions'. + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'GenerateBoundingBoxProposals'. /// - /// + /// /// Optional argument - /// Do not use. For testing purposes only. - /// - /// - /// GCP project ID. - /// - /// - /// BigQuery Dataset ID. - /// - /// - /// Table to read. - /// - /// - /// List of columns to read. Leave empty to read all columns. - /// - /// - /// Table snapshot timestamp in millis since epoch. Relative - /// (negative or zero) snapshot times are not allowed. For more details, see - /// 'Table Decorators' in BigQuery docs. - /// - /// - /// Number of partitions to split the table into. + /// An integer. Maximum number of rois in the output. /// /// - /// Serialized table partitions. - /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// Returns a tuple with multiple values, as follows: + /// rois: A 3-D float tensor of shape [num_images,post_nms_topn,4] representing the selected + /// region of interest boxes. Sorted in descending order in scores. + /// roi_probabilities: A 2-D float tensor of shape [num_images, post_nms_topn] representing the score of the + /// region of interest box in rois tensor at the same index. + /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. /// /// - /// This op should not be used directly by clients. Instead, the - /// bigquery_reader_ops.py file defines a clean interface to the reader. + /// The op selects top pre_nms_topn scoring boxes, decodes them with respect to anchors, + /// applies non-maximal suppression on overlapping boxes with higher than + /// nms_threshold intersection-over-union (iou) value, discarding boxes where shorter + /// side is less than min_size. + /// Inputs: + /// scores: A 4D tensor of shape [Batch, Height, Width, Num Anchors] containing the scores per anchor at given position + /// bbox_deltas: is a tensor of shape [Batch, Height, Width, 4 x Num Anchors] boxes encoded to each anchor + /// anchors: A 1D tensor of shape [4 x Num Anchors], representing the anchors. + /// Outputs: + /// rois: output RoIs, a 3D tensor of shape [Batch, post_nms_topn, 4], padded by 0 if less than post_nms_topn candidates found. + /// roi_probabilities: probability scores of each roi in 'rois', a 2D tensor of shape [Batch,post_nms_topn], padded with 0 if needed, sorted by scores. /// - public TFOutput GenerateBigQueryReaderPartitions (string project_id, string dataset_id, string table_id, string[] columns, long timestamp_millis, long num_partitions, string test_end_point = null, string operName = null) + public (TFOutput rois, TFOutput roi_probabilities) GenerateBoundingBoxProposals (TFOutput scores, TFOutput bbox_deltas, TFOutput image_info, TFOutput anchors, TFOutput nms_threshold, TFOutput pre_nms_topn, TFOutput min_size, long? post_nms_topn = null, string operName = null) { - var desc = new TFOperationDesc (this, "GenerateBigQueryReaderPartitions", MakeName ("GenerateBigQueryReaderPartitions", operName)); + var desc = new TFOperationDesc (this, "GenerateBoundingBoxProposals", MakeName ("GenerateBoundingBoxProposals", operName)); + desc.AddInput (scores); + desc.AddInput (bbox_deltas); + desc.AddInput (image_info); + desc.AddInput (anchors); + desc.AddInput (nms_threshold); + desc.AddInput (pre_nms_topn); + desc.AddInput (min_size); foreach ( TFOperation control in CurrentDependencies ) desc.AddControlInput (control); - desc.SetAttr ("project_id", project_id); - desc.SetAttr ("dataset_id", dataset_id); - desc.SetAttr ("table_id", table_id); - desc.SetAttr ("columns", columns); - desc.SetAttr ("timestamp_millis", timestamp_millis); - desc.SetAttr ("num_partitions", num_partitions); - if (test_end_point != null) - desc.SetAttr ("test_end_point", test_end_point); + if (post_nms_topn.HasValue) + desc.SetAttr ("post_nms_topn", post_nms_topn.Value); var op = desc.FinishOperation (); int _idx = 0; - var partitions = new TFOutput (op, _idx++); - return partitions; + var rois = new TFOutput (op, _idx++); + var roi_probabilities = new TFOutput (op, _idx++); + return (rois, roi_probabilities); } /// @@ -18852,6 +20566,31 @@ public TFOutput GenerateBigQueryReaderPartitions (string project_id, string data return (remapping, num_present); } + /// + /// Returns the tf.data.Options attached to input_dataset. + /// + /// + /// A variant tensor representing the input dataset. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'GetOptions'. + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + public TFOutput GetOptions (TFOutput input_dataset, string operName = null) + { + var desc = new TFOperationDesc (this, "GetOptions", MakeName ("GetOptions", operName)); + desc.AddInput (input_dataset); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var serialized_options = new TFOutput (op, _idx++); + return serialized_options; + } + /// /// Store the input tensor in the state of the current session. /// @@ -19884,9 +21623,9 @@ public TFOutput Igamma (TFOutput a, TFOutput x, string operName = null) /// /// where /// - /// \\(Gamma(a, x) = int_{x}^{\infty} t^{a-1} exp(-t) dt\\) + /// \\(Gamma(a, x) = \int_{x}^{\infty} t^{a-1} exp(-t) dt\\) /// - /// is the upper incomplete Gama function. + /// is the upper incomplete Gamma function. /// /// Note, above P(a, x) (Igamma) is the lower regularized complete /// Gamma function. @@ -19940,6 +21679,9 @@ public TFOutput IgammaGradA (TFOutput a, TFOutput x, string operName = null) /// /// If specified, the created operation in the graph will be this one, otherwise it will be named 'IgnoreErrorsDataset'. /// + /// + /// Optional argument + /// /// /// /// @@ -19947,7 +21689,7 @@ public TFOutput IgammaGradA (TFOutput a, TFOutput x, string operName = null) /// /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// - public TFOutput IgnoreErrorsDataset (TFOutput input_dataset, TFDataType[] output_types, TFShape[] output_shapes, string operName = null) + public TFOutput IgnoreErrorsDataset (TFOutput input_dataset, TFDataType[] output_types, TFShape[] output_shapes, bool? log_warning = null, string operName = null) { var desc = new TFOperationDesc (this, "IgnoreErrorsDataset", MakeName ("IgnoreErrorsDataset", operName)); desc.AddInput (input_dataset); @@ -19956,6 +21698,9 @@ public TFOutput IgnoreErrorsDataset (TFOutput input_dataset, TFDataType[] output desc.SetAttrType ("output_types", output_types); desc.SetAttrShape ("output_shapes", output_shapes); + if (log_warning.HasValue) + desc.SetAttr ("log_warning", log_warning.Value); + var op = desc.FinishOperation (); int _idx = 0; var handle = new TFOutput (op, _idx++); @@ -20005,6 +21750,120 @@ public TFOutput Imag (TFOutput input, TFDataType? Tout = null, string operName = return output; } + /// + /// Applies the given transform to each of the images. + /// + /// + /// 4-D with shape [batch, height, width, channels]. + /// + /// + /// 2-D Tensor, [batch, 8] or [1, 8] matrix, where each row corresponds to a 3 x 3 + /// projective transformation matrix, with the last entry assumed to be 1. If there + /// is one row, the same transformation will be applied to all images. + /// + /// + /// 1-D Tensor [new_height, new_width]. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ImageProjectiveTransformV2'. + /// + /// + /// Optional argument + /// Fill mode, "REFLECT", "WRAP", or "CONSTANT". + /// + /// + /// Interpolation method, "NEAREST" or "BILINEAR". + /// + /// + /// 4-D with shape + /// [batch, new_height, new_width, channels]. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// If one row of transforms is [a0, a1, a2, b0, b1, b2, c0, c1], then it maps + /// the *output* point (x, y) to a transformed *input* point + /// (x', y') = ((a0 x + a1 y + a2) / k, (b0 x + b1 y + b2) / k), where + /// k = c0 x + c1 y + 1. If the transformed point lays outside of the input + /// image, the output pixel is set to 0. + /// + public TFOutput ImageProjectiveTransformV2 (TFOutput images, TFOutput transforms, TFOutput output_shape, string interpolation, string fill_mode = null, string operName = null) + { + var desc = new TFOperationDesc (this, "ImageProjectiveTransformV2", MakeName ("ImageProjectiveTransformV2", operName)); + desc.AddInput (images); + desc.AddInput (transforms); + desc.AddInput (output_shape); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("interpolation", interpolation); + if (fill_mode != null) + desc.SetAttr ("fill_mode", fill_mode); + + var op = desc.FinishOperation (); + int _idx = 0; + var transformed_images = new TFOutput (op, _idx++); + return transformed_images; + } + + /// + /// Applies the given transform to each of the images. + /// + /// + /// 4-D with shape [batch, height, width, channels]. + /// + /// + /// 2-D Tensor, [batch, 8] or [1, 8] matrix, where each row corresponds to a 3 x 3 + /// projective transformation matrix, with the last entry assumed to be 1. If there + /// is one row, the same transformation will be applied to all images. + /// + /// + /// 1-D Tensor [new_height, new_width]. + /// + /// + /// float, the value to be filled when fill_mode is constant". + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ImageProjectiveTransformV3'. + /// + /// + /// Optional argument + /// Fill mode, "REFLECT", "WRAP", "CONSTANT", or "NEAREST". + /// + /// + /// Interpolation method, "NEAREST" or "BILINEAR". + /// + /// + /// 4-D with shape + /// [batch, new_height, new_width, channels]. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// If one row of transforms is [a0, a1, a2, b0, b1, b2, c0, c1], then it maps + /// the *output* point (x, y) to a transformed *input* point + /// (x', y') = ((a0 x + a1 y + a2) / k, (b0 x + b1 y + b2) / k), where + /// k = c0 x + c1 y + 1. If the transformed point lays outside of the input + /// image, the output pixel is set to fill_value. + /// + public TFOutput ImageProjectiveTransformV3 (TFOutput images, TFOutput transforms, TFOutput output_shape, TFOutput fill_value, string interpolation, string fill_mode = null, string operName = null) + { + var desc = new TFOperationDesc (this, "ImageProjectiveTransformV3", MakeName ("ImageProjectiveTransformV3", operName)); + desc.AddInput (images); + desc.AddInput (transforms); + desc.AddInput (output_shape); + desc.AddInput (fill_value); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("interpolation", interpolation); + if (fill_mode != null) + desc.SetAttr ("fill_mode", fill_mode); + + var op = desc.FinishOperation (); + int _idx = 0; + var transformed_images = new TFOutput (op, _idx++); + return transformed_images; + } + /// /// Outputs a Summary protocol buffer with images. /// @@ -20363,6 +22222,9 @@ public TFOperation InitializeTable (TFOutput table_handle, TFOutput keys, TFOutp /// Optional argument /// Delimiter to separate fields in a line. /// + /// + /// Optional argument + /// /// /// Column index in a line to get the table key values from. /// @@ -20385,7 +22247,7 @@ public TFOperation InitializeTable (TFOutput table_handle, TFOutput keys, TFOutp /// - A value &gt;= 0 means use the index (starting at zero) of the split line based /// on delimiter. /// - public TFOperation InitializeTableFromTextFile (TFOutput table_handle, TFOutput filename, long key_index, long value_index, long? vocab_size = null, string delimiter = null, string operName = null) + public TFOperation InitializeTableFromTextFile (TFOutput table_handle, TFOutput filename, long key_index, long value_index, long? vocab_size = null, string delimiter = null, long? offset = null, string operName = null) { var desc = new TFOperationDesc (this, "InitializeTableFromTextFile", MakeName ("InitializeTableFromTextFile", operName)); desc.AddInput (table_handle); @@ -20401,6 +22263,9 @@ public TFOperation InitializeTableFromTextFile (TFOutput table_handle, TFOutput if (delimiter != null) desc.SetAttr ("delimiter", delimiter); + if (offset.HasValue) + desc.SetAttr ("offset", offset.Value); + var op = desc.FinishOperation (); return op; } @@ -20425,6 +22290,9 @@ public TFOperation InitializeTableFromTextFile (TFOutput table_handle, TFOutput /// Optional argument /// Delimiter to separate fields in a line. /// + /// + /// Optional argument + /// /// /// Column index in a line to get the table key values from. /// @@ -20447,7 +22315,7 @@ public TFOperation InitializeTableFromTextFile (TFOutput table_handle, TFOutput /// - A value &gt;= 0 means use the index (starting at zero) of the split line based /// on delimiter. /// - public TFOperation InitializeTableFromTextFileV2 (TFOutput table_handle, TFOutput filename, long key_index, long value_index, long? vocab_size = null, string delimiter = null, string operName = null) + public TFOperation InitializeTableFromTextFileV2 (TFOutput table_handle, TFOutput filename, long key_index, long value_index, long? vocab_size = null, string delimiter = null, long? offset = null, string operName = null) { var desc = new TFOperationDesc (this, "InitializeTableFromTextFileV2", MakeName ("InitializeTableFromTextFileV2", operName)); desc.AddInput (table_handle); @@ -20463,6 +22331,9 @@ public TFOperation InitializeTableFromTextFileV2 (TFOutput table_handle, TFOutpu if (delimiter != null) desc.SetAttr ("delimiter", delimiter); + if (offset.HasValue) + desc.SetAttr ("offset", offset.Value); + var op = desc.FinishOperation (); return op; } @@ -20500,8 +22371,6 @@ public TFOperation InitializeTableV2 (TFOutput table_handle, TFOutput keys, TFOu /// /// Adds v into specified rows of x. - /// - /// Computes y = x; y[i, :] += v; return y. /// /// /// A Tensor of type T. @@ -20519,6 +22388,9 @@ public TFOperation InitializeTableV2 (TFOutput table_handle, TFOutput keys, TFOu /// A Tensor of type T. An alias of x. The content of y is undefined if there are duplicates in i. /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// + /// + /// Computes y = x; y[i, :] += v; return y. + /// public TFOutput InplaceAdd (TFOutput x, TFOutput i, TFOutput v, string operName = null) { var desc = new TFOperationDesc (this, "InplaceAdd", MakeName ("InplaceAdd", operName)); @@ -20571,9 +22443,7 @@ public TFOutput InplaceSub (TFOutput x, TFOutput i, TFOutput v, string operName } /// - /// Updates specified rows with values in v. - /// - /// Computes x[i, :] = v; return x. + /// Updates specified rows 'i' with values 'v'. /// /// /// A tensor of type T. @@ -20591,6 +22461,12 @@ public TFOutput InplaceSub (TFOutput x, TFOutput i, TFOutput v, string operName /// A Tensor of type T. An alias of x. The content of y is undefined if there are duplicates in i. /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// + /// + /// Computes x[i, :] = v; return x. + /// + /// Originally this function is mutative however for compilation we make this + /// operation create / operate on a copy of x. + /// public TFOutput InplaceUpdate (TFOutput x, TFOutput i, TFOutput v, string operName = null) { var desc = new TFOperationDesc (this, "InplaceUpdate", MakeName ("InplaceUpdate", operName)); @@ -20884,6 +22760,9 @@ public TFOutput InvGrad (TFOutput y, TFOutput dy, string operName = null) /// /// If specified, the created operation in the graph will be this one, otherwise it will be named 'IRFFT'. /// + /// + /// Optional argument + /// /// /// A float32 tensor of the same rank as input. The inner-most /// dimension of input is replaced with the fft_length samples of its inverse @@ -20909,7 +22788,7 @@ public TFOutput InvGrad (TFOutput y, TFOutput dy, string operName = null) /// than the corresponding dimension of input, the dimension is cropped. If it is /// larger, the dimension is padded with zeros. /// - public TFOutput IRFFT (TFOutput input, TFOutput fft_length, string operName = null) + public TFOutput IRFFT (TFOutput input, TFOutput fft_length, TFDataType? Treal = null, string operName = null) { var desc = new TFOperationDesc (this, "IRFFT", MakeName ("IRFFT", operName)); desc.AddInput (input); @@ -20917,6 +22796,9 @@ public TFOutput IRFFT (TFOutput input, TFOutput fft_length, string operName = nu foreach ( TFOperation control in CurrentDependencies ) desc.AddControlInput (control); + if (Treal.HasValue) + desc.SetAttrType ("Treal", Treal.Value); + var op = desc.FinishOperation (); int _idx = 0; var output = new TFOutput (op, _idx++); @@ -20935,6 +22817,9 @@ public TFOutput IRFFT (TFOutput input, TFOutput fft_length, string operName = nu /// /// If specified, the created operation in the graph will be this one, otherwise it will be named 'IRFFT2D'. /// + /// + /// Optional argument + /// /// /// A float32 tensor of the same rank as input. The inner-most 2 /// dimensions of input are replaced with the fft_length samples of their @@ -20961,7 +22846,7 @@ public TFOutput IRFFT (TFOutput input, TFOutput fft_length, string operName = nu /// corresponding dimension of input, the dimension is cropped. If it is larger, /// the dimension is padded with zeros. /// - public TFOutput IRFFT2D (TFOutput input, TFOutput fft_length, string operName = null) + public TFOutput IRFFT2D (TFOutput input, TFOutput fft_length, TFDataType? Treal = null, string operName = null) { var desc = new TFOperationDesc (this, "IRFFT2D", MakeName ("IRFFT2D", operName)); desc.AddInput (input); @@ -20969,6 +22854,9 @@ public TFOutput IRFFT2D (TFOutput input, TFOutput fft_length, string operName = foreach ( TFOperation control in CurrentDependencies ) desc.AddControlInput (control); + if (Treal.HasValue) + desc.SetAttrType ("Treal", Treal.Value); + var op = desc.FinishOperation (); int _idx = 0; var output = new TFOutput (op, _idx++); @@ -20987,6 +22875,9 @@ public TFOutput IRFFT2D (TFOutput input, TFOutput fft_length, string operName = /// /// If specified, the created operation in the graph will be this one, otherwise it will be named 'IRFFT3D'. /// + /// + /// Optional argument + /// /// /// A float32 tensor of the same rank as input. The inner-most 3 /// dimensions of input are replaced with the fft_length samples of their @@ -21013,7 +22904,7 @@ public TFOutput IRFFT2D (TFOutput input, TFOutput fft_length, string operName = /// corresponding dimension of input, the dimension is cropped. If it is larger, /// the dimension is padded with zeros. /// - public TFOutput IRFFT3D (TFOutput input, TFOutput fft_length, string operName = null) + public TFOutput IRFFT3D (TFOutput input, TFOutput fft_length, TFDataType? Treal = null, string operName = null) { var desc = new TFOperationDesc (this, "IRFFT3D", MakeName ("IRFFT3D", operName)); desc.AddInput (input); @@ -21021,6 +22912,9 @@ public TFOutput IRFFT3D (TFOutput input, TFOutput fft_length, string operName = foreach ( TFOperation control in CurrentDependencies ) desc.AddControlInput (control); + if (Treal.HasValue) + desc.SetAttrType ("Treal", Treal.Value); + var op = desc.FinishOperation (); int _idx = 0; var output = new TFOutput (op, _idx++); @@ -21031,7 +22925,7 @@ public TFOutput IRFFT3D (TFOutput input, TFOutput fft_length, string operName = /// Checks whether a tree ensemble has been initialized. /// /// - /// Handle to the tree ensemble resouce. + /// Handle to the tree ensemble resource. /// /// /// If specified, the created operation in the graph will be this one, otherwise it will be named 'IsBoostedTreesEnsembleInitialized'. @@ -21190,6 +23084,42 @@ public TFOutput IsNan (TFOutput x, string operName = null) return y; } + /// + /// Solves a batch of isotonic regression problems. + /// + /// + /// A (batch_size, dim)-tensor holding a batch of inputs. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'IsotonicRegression'. + /// + /// + /// Optional argument + /// Dtype of output. + /// + /// + /// Returns a tuple with multiple values, as follows: + /// output: A (batch_size, dim)-tensor holding the per-batch element solutions. + /// segments: An int32 (batch_size, dim)-tensor with the segments. + /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. + /// + public (TFOutput output, TFOutput segments) IsotonicRegression (TFOutput input, TFDataType? output_dtype = null, string operName = null) + { + var desc = new TFOperationDesc (this, "IsotonicRegression", MakeName ("IsotonicRegression", operName)); + desc.AddInput (input); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (output_dtype.HasValue) + desc.SetAttrType ("output_dtype", output_dtype.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + var segments = new TFOutput (op, _idx++); + return (output, segments); + } + /// /// Checks whether a tensor has been initialized. /// @@ -21535,6 +23465,49 @@ public TFOutput KmeansPlusPlusInitialization (TFOutput points, TFOutput num_to_s return samples; } + /// + /// Computes the Kth order statistic of a data set. The current + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'KthOrderStatistic'. + /// + /// + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// implementation uses a binary search requiring exactly 32 passes over + /// the input data. The running time is linear with respect to input + /// size. The median-of-medians algorithm is probably faster, but is + /// difficult to implement efficiently in XLA. The implementation imposes + /// a total ordering on floats. The ordering is consistent with the usual + /// partial order. Positive NaNs are greater than positive + /// infinity. Negative NaNs are less than negative infinity. NaNs with + /// distinct payloads are treated as distinct. Subnormal numbers are + /// preserved (not flushed to zero). Positive infinity is greater than all + /// numbers. Negative infinity is less than all numbers. Positive is + /// greater than negative zero. There are less than k values greater than + /// the kth order statistic. There are at least k values greater than or + /// equal to the Kth order statistic. The semantics are not the same as + /// top_k_unique. + /// + public TFOutput KthOrderStatistic (TFOutput input, long k, string operName = null) + { + var desc = new TFOperationDesc (this, "KthOrderStatistic", MakeName ("KthOrderStatistic", operName)); + desc.AddInput (input); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("k", k); + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + /// /// L2 Loss. /// @@ -22244,63 +24217,7 @@ public TFOutput LoadAndRemapMatrix (TFOutput ckpt_path, TFOutput old_tensor_name /// /// Optional argument /// - /// - /// - /// - /// - /// - /// Returns the description of the operation - /// - /// - /// An op that loads optimization parameters into HBM for embedding. Must be - /// preceded by a ConfigureTPUEmbeddingHost op that sets up the correct - /// embedding table configuration. For example, this op is used to install - /// parameters that are loaded from a checkpoint before a training loop is - /// executed. - /// - public TFOperation LoadTPUEmbeddingAdadeltaParameters (TFOutput parameters, TFOutput accumulators, TFOutput updates, long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) - { - var desc = new TFOperationDesc (this, "LoadTPUEmbeddingAdadeltaParameters", MakeName ("LoadTPUEmbeddingAdadeltaParameters", operName)); - desc.AddInput (parameters); - desc.AddInput (accumulators); - desc.AddInput (updates); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - desc.SetAttr ("num_shards", num_shards); - desc.SetAttr ("shard_id", shard_id); - if (table_id.HasValue) - desc.SetAttr ("table_id", table_id.Value); - - if (table_name != null) - desc.SetAttr ("table_name", table_name); - - var op = desc.FinishOperation (); - return op; - } - - /// - /// Load Adadelta parameters with debug support. - /// - /// - /// Value of parameters used in the Adadelta optimization algorithm. - /// - /// - /// Value of accumulators used in the Adadelta optimization algorithm. - /// - /// - /// Value of updates used in the Adadelta optimization algorithm. - /// - /// - /// Value of gradient_accumulators used in the Adadelta optimization algorithm. - /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'LoadTPUEmbeddingAdadeltaParametersGradAccumDebug'. - /// - /// - /// Optional argument - /// - /// + /// /// Optional argument /// /// @@ -22317,13 +24234,12 @@ public TFOperation LoadTPUEmbeddingAdadeltaParameters (TFOutput parameters, TFOu /// parameters that are loaded from a checkpoint before a training loop is /// executed. /// - public TFOperation LoadTPUEmbeddingAdadeltaParametersGradAccumDebug (TFOutput parameters, TFOutput accumulators, TFOutput updates, TFOutput gradient_accumulators, long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) + public TFOperation LoadTPUEmbeddingAdadeltaParameters (TFOutput parameters, TFOutput accumulators, TFOutput updates, long num_shards, long shard_id, long? table_id = null, string table_name = null, string config = null, string operName = null) { - var desc = new TFOperationDesc (this, "LoadTPUEmbeddingAdadeltaParametersGradAccumDebug", MakeName ("LoadTPUEmbeddingAdadeltaParametersGradAccumDebug", operName)); + var desc = new TFOperationDesc (this, "LoadTPUEmbeddingAdadeltaParameters", MakeName ("LoadTPUEmbeddingAdadeltaParameters", operName)); desc.AddInput (parameters); desc.AddInput (accumulators); desc.AddInput (updates); - desc.AddInput (gradient_accumulators); foreach ( TFOperation control in CurrentDependencies ) desc.AddControlInput (control); @@ -22335,6 +24251,9 @@ public TFOperation LoadTPUEmbeddingAdadeltaParametersGradAccumDebug (TFOutput pa if (table_name != null) desc.SetAttr ("table_name", table_name); + if (config != null) + desc.SetAttr ("config", config); + var op = desc.FinishOperation (); return op; } @@ -22357,59 +24276,7 @@ public TFOperation LoadTPUEmbeddingAdadeltaParametersGradAccumDebug (TFOutput pa /// /// Optional argument /// - /// - /// - /// - /// - /// - /// Returns the description of the operation - /// - /// - /// An op that loads optimization parameters into HBM for embedding. Must be - /// preceded by a ConfigureTPUEmbeddingHost op that sets up the correct - /// embedding table configuration. For example, this op is used to install - /// parameters that are loaded from a checkpoint before a training loop is - /// executed. - /// - public TFOperation LoadTPUEmbeddingAdagradParameters (TFOutput parameters, TFOutput accumulators, long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) - { - var desc = new TFOperationDesc (this, "LoadTPUEmbeddingAdagradParameters", MakeName ("LoadTPUEmbeddingAdagradParameters", operName)); - desc.AddInput (parameters); - desc.AddInput (accumulators); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - desc.SetAttr ("num_shards", num_shards); - desc.SetAttr ("shard_id", shard_id); - if (table_id.HasValue) - desc.SetAttr ("table_id", table_id.Value); - - if (table_name != null) - desc.SetAttr ("table_name", table_name); - - var op = desc.FinishOperation (); - return op; - } - - /// - /// Load Adagrad embedding parameters with debug support. - /// - /// - /// Value of parameters used in the Adagrad optimization algorithm. - /// - /// - /// Value of accumulators used in the Adagrad optimization algorithm. - /// - /// - /// Value of gradient_accumulators used in the Adagrad optimization algorithm. - /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'LoadTPUEmbeddingAdagradParametersGradAccumDebug'. - /// - /// - /// Optional argument - /// - /// + /// /// Optional argument /// /// @@ -22426,12 +24293,11 @@ public TFOperation LoadTPUEmbeddingAdagradParameters (TFOutput parameters, TFOut /// parameters that are loaded from a checkpoint before a training loop is /// executed. /// - public TFOperation LoadTPUEmbeddingAdagradParametersGradAccumDebug (TFOutput parameters, TFOutput accumulators, TFOutput gradient_accumulators, long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) + public TFOperation LoadTPUEmbeddingAdagradParameters (TFOutput parameters, TFOutput accumulators, long num_shards, long shard_id, long? table_id = null, string table_name = null, string config = null, string operName = null) { - var desc = new TFOperationDesc (this, "LoadTPUEmbeddingAdagradParametersGradAccumDebug", MakeName ("LoadTPUEmbeddingAdagradParametersGradAccumDebug", operName)); + var desc = new TFOperationDesc (this, "LoadTPUEmbeddingAdagradParameters", MakeName ("LoadTPUEmbeddingAdagradParameters", operName)); desc.AddInput (parameters); desc.AddInput (accumulators); - desc.AddInput (gradient_accumulators); foreach ( TFOperation control in CurrentDependencies ) desc.AddControlInput (control); @@ -22443,6 +24309,9 @@ public TFOperation LoadTPUEmbeddingAdagradParametersGradAccumDebug (TFOutput par if (table_name != null) desc.SetAttr ("table_name", table_name); + if (config != null) + desc.SetAttr ("config", config); + var op = desc.FinishOperation (); return op; } @@ -22468,63 +24337,7 @@ public TFOperation LoadTPUEmbeddingAdagradParametersGradAccumDebug (TFOutput par /// /// Optional argument /// - /// - /// - /// - /// - /// - /// Returns the description of the operation - /// - /// - /// An op that loads optimization parameters into HBM for embedding. Must be - /// preceded by a ConfigureTPUEmbeddingHost op that sets up the correct - /// embedding table configuration. For example, this op is used to install - /// parameters that are loaded from a checkpoint before a training loop is - /// executed. - /// - public TFOperation LoadTPUEmbeddingADAMParameters (TFOutput parameters, TFOutput momenta, TFOutput velocities, long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) - { - var desc = new TFOperationDesc (this, "LoadTPUEmbeddingADAMParameters", MakeName ("LoadTPUEmbeddingADAMParameters", operName)); - desc.AddInput (parameters); - desc.AddInput (momenta); - desc.AddInput (velocities); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - desc.SetAttr ("num_shards", num_shards); - desc.SetAttr ("shard_id", shard_id); - if (table_id.HasValue) - desc.SetAttr ("table_id", table_id.Value); - - if (table_name != null) - desc.SetAttr ("table_name", table_name); - - var op = desc.FinishOperation (); - return op; - } - - /// - /// Load ADAM embedding parameters with debug support. - /// - /// - /// Value of parameters used in the ADAM optimization algorithm. - /// - /// - /// Value of momenta used in the ADAM optimization algorithm. - /// - /// - /// Value of velocities used in the ADAM optimization algorithm. - /// - /// - /// Value of gradient_accumulators used in the ADAM optimization algorithm. - /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'LoadTPUEmbeddingADAMParametersGradAccumDebug'. - /// - /// - /// Optional argument - /// - /// + /// /// Optional argument /// /// @@ -22541,13 +24354,12 @@ public TFOperation LoadTPUEmbeddingADAMParameters (TFOutput parameters, TFOutput /// parameters that are loaded from a checkpoint before a training loop is /// executed. /// - public TFOperation LoadTPUEmbeddingADAMParametersGradAccumDebug (TFOutput parameters, TFOutput momenta, TFOutput velocities, TFOutput gradient_accumulators, long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) + public TFOperation LoadTPUEmbeddingADAMParameters (TFOutput parameters, TFOutput momenta, TFOutput velocities, long num_shards, long shard_id, long? table_id = null, string table_name = null, string config = null, string operName = null) { - var desc = new TFOperationDesc (this, "LoadTPUEmbeddingADAMParametersGradAccumDebug", MakeName ("LoadTPUEmbeddingADAMParametersGradAccumDebug", operName)); + var desc = new TFOperationDesc (this, "LoadTPUEmbeddingADAMParameters", MakeName ("LoadTPUEmbeddingADAMParameters", operName)); desc.AddInput (parameters); desc.AddInput (momenta); desc.AddInput (velocities); - desc.AddInput (gradient_accumulators); foreach ( TFOperation control in CurrentDependencies ) desc.AddControlInput (control); @@ -22559,6 +24371,9 @@ public TFOperation LoadTPUEmbeddingADAMParametersGradAccumDebug (TFOutput parame if (table_name != null) desc.SetAttr ("table_name", table_name); + if (config != null) + desc.SetAttr ("config", config); + var op = desc.FinishOperation (); return op; } @@ -22587,6 +24402,9 @@ public TFOperation LoadTPUEmbeddingADAMParametersGradAccumDebug (TFOutput parame /// /// Optional argument /// + /// + /// Optional argument + /// /// /// /// @@ -22601,7 +24419,7 @@ public TFOperation LoadTPUEmbeddingADAMParametersGradAccumDebug (TFOutput parame /// parameters that are loaded from a checkpoint before a training loop is /// executed. /// - public TFOperation LoadTPUEmbeddingCenteredRMSPropParameters (TFOutput parameters, TFOutput ms, TFOutput mom, TFOutput mg, long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) + public TFOperation LoadTPUEmbeddingCenteredRMSPropParameters (TFOutput parameters, TFOutput ms, TFOutput mom, TFOutput mg, long num_shards, long shard_id, long? table_id = null, string table_name = null, string config = null, string operName = null) { var desc = new TFOperationDesc (this, "LoadTPUEmbeddingCenteredRMSPropParameters", MakeName ("LoadTPUEmbeddingCenteredRMSPropParameters", operName)); desc.AddInput (parameters); @@ -22619,24 +24437,24 @@ public TFOperation LoadTPUEmbeddingCenteredRMSPropParameters (TFOutput parameter if (table_name != null) desc.SetAttr ("table_name", table_name); + if (config != null) + desc.SetAttr ("config", config); + var op = desc.FinishOperation (); return op; } /// - /// Load FTRL embedding parameters. + /// Load frequency estimator embedding parameters. /// /// - /// Value of parameters used in the FTRL optimization algorithm. - /// - /// - /// Value of accumulators used in the FTRL optimization algorithm. + /// Value of parameters used in the frequency estimator optimization algorithm. /// - /// - /// Value of linears used in the FTRL optimization algorithm. + /// + /// Value of last_hit_step used in the frequency estimator optimization algorithm. /// /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'LoadTPUEmbeddingFTRLParameters'. + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'LoadTPUEmbeddingFrequencyEstimatorParameters'. /// /// /// Optional argument @@ -22644,6 +24462,9 @@ public TFOperation LoadTPUEmbeddingCenteredRMSPropParameters (TFOutput parameter /// /// Optional argument /// + /// + /// Optional argument + /// /// /// /// @@ -22658,12 +24479,11 @@ public TFOperation LoadTPUEmbeddingCenteredRMSPropParameters (TFOutput parameter /// parameters that are loaded from a checkpoint before a training loop is /// executed. /// - public TFOperation LoadTPUEmbeddingFTRLParameters (TFOutput parameters, TFOutput accumulators, TFOutput linears, long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) + public TFOperation LoadTPUEmbeddingFrequencyEstimatorParameters (TFOutput parameters, TFOutput last_hit_step, long num_shards, long shard_id, long? table_id = null, string table_name = null, string config = null, string operName = null) { - var desc = new TFOperationDesc (this, "LoadTPUEmbeddingFTRLParameters", MakeName ("LoadTPUEmbeddingFTRLParameters", operName)); + var desc = new TFOperationDesc (this, "LoadTPUEmbeddingFrequencyEstimatorParameters", MakeName ("LoadTPUEmbeddingFrequencyEstimatorParameters", operName)); desc.AddInput (parameters); - desc.AddInput (accumulators); - desc.AddInput (linears); + desc.AddInput (last_hit_step); foreach ( TFOperation control in CurrentDependencies ) desc.AddControlInput (control); @@ -22675,12 +24495,15 @@ public TFOperation LoadTPUEmbeddingFTRLParameters (TFOutput parameters, TFOutput if (table_name != null) desc.SetAttr ("table_name", table_name); + if (config != null) + desc.SetAttr ("config", config); + var op = desc.FinishOperation (); return op; } /// - /// Load FTRL embedding parameters with debug support. + /// Load FTRL embedding parameters. /// /// /// Value of parameters used in the FTRL optimization algorithm. @@ -22691,11 +24514,8 @@ public TFOperation LoadTPUEmbeddingFTRLParameters (TFOutput parameters, TFOutput /// /// Value of linears used in the FTRL optimization algorithm. /// - /// - /// Value of gradient_accumulators used in the FTRL optimization algorithm. - /// /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'LoadTPUEmbeddingFTRLParametersGradAccumDebug'. + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'LoadTPUEmbeddingFTRLParameters'. /// /// /// Optional argument @@ -22703,6 +24523,9 @@ public TFOperation LoadTPUEmbeddingFTRLParameters (TFOutput parameters, TFOutput /// /// Optional argument /// + /// + /// Optional argument + /// /// /// /// @@ -22717,13 +24540,12 @@ public TFOperation LoadTPUEmbeddingFTRLParameters (TFOutput parameters, TFOutput /// parameters that are loaded from a checkpoint before a training loop is /// executed. /// - public TFOperation LoadTPUEmbeddingFTRLParametersGradAccumDebug (TFOutput parameters, TFOutput accumulators, TFOutput linears, TFOutput gradient_accumulators, long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) + public TFOperation LoadTPUEmbeddingFTRLParameters (TFOutput parameters, TFOutput accumulators, TFOutput linears, long num_shards, long shard_id, long? table_id = null, string table_name = null, string config = null, string operName = null) { - var desc = new TFOperationDesc (this, "LoadTPUEmbeddingFTRLParametersGradAccumDebug", MakeName ("LoadTPUEmbeddingFTRLParametersGradAccumDebug", operName)); + var desc = new TFOperationDesc (this, "LoadTPUEmbeddingFTRLParameters", MakeName ("LoadTPUEmbeddingFTRLParameters", operName)); desc.AddInput (parameters); desc.AddInput (accumulators); desc.AddInput (linears); - desc.AddInput (gradient_accumulators); foreach ( TFOperation control in CurrentDependencies ) desc.AddControlInput (control); @@ -22735,6 +24557,9 @@ public TFOperation LoadTPUEmbeddingFTRLParametersGradAccumDebug (TFOutput parame if (table_name != null) desc.SetAttr ("table_name", table_name); + if (config != null) + desc.SetAttr ("config", config); + var op = desc.FinishOperation (); return op; } @@ -22763,6 +24588,9 @@ public TFOperation LoadTPUEmbeddingFTRLParametersGradAccumDebug (TFOutput parame /// /// Optional argument /// + /// + /// Optional argument + /// /// /// /// @@ -22777,7 +24605,7 @@ public TFOperation LoadTPUEmbeddingFTRLParametersGradAccumDebug (TFOutput parame /// parameters that are loaded from a checkpoint before a training loop is /// executed. /// - public TFOperation LoadTPUEmbeddingMDLAdagradLightParameters (TFOutput parameters, TFOutput accumulators, TFOutput weights, TFOutput benefits, long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) + public TFOperation LoadTPUEmbeddingMDLAdagradLightParameters (TFOutput parameters, TFOutput accumulators, TFOutput weights, TFOutput benefits, long num_shards, long shard_id, long? table_id = null, string table_name = null, string config = null, string operName = null) { var desc = new TFOperationDesc (this, "LoadTPUEmbeddingMDLAdagradLightParameters", MakeName ("LoadTPUEmbeddingMDLAdagradLightParameters", operName)); desc.AddInput (parameters); @@ -22795,6 +24623,9 @@ public TFOperation LoadTPUEmbeddingMDLAdagradLightParameters (TFOutput parameter if (table_name != null) desc.SetAttr ("table_name", table_name); + if (config != null) + desc.SetAttr ("config", config); + var op = desc.FinishOperation (); return op; } @@ -22817,59 +24648,7 @@ public TFOperation LoadTPUEmbeddingMDLAdagradLightParameters (TFOutput parameter /// /// Optional argument /// - /// - /// - /// - /// - /// - /// Returns the description of the operation - /// - /// - /// An op that loads optimization parameters into HBM for embedding. Must be - /// preceded by a ConfigureTPUEmbeddingHost op that sets up the correct - /// embedding table configuration. For example, this op is used to install - /// parameters that are loaded from a checkpoint before a training loop is - /// executed. - /// - public TFOperation LoadTPUEmbeddingMomentumParameters (TFOutput parameters, TFOutput momenta, long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) - { - var desc = new TFOperationDesc (this, "LoadTPUEmbeddingMomentumParameters", MakeName ("LoadTPUEmbeddingMomentumParameters", operName)); - desc.AddInput (parameters); - desc.AddInput (momenta); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - desc.SetAttr ("num_shards", num_shards); - desc.SetAttr ("shard_id", shard_id); - if (table_id.HasValue) - desc.SetAttr ("table_id", table_id.Value); - - if (table_name != null) - desc.SetAttr ("table_name", table_name); - - var op = desc.FinishOperation (); - return op; - } - - /// - /// Load Momentum embedding parameters with debug support. - /// - /// - /// Value of parameters used in the Momentum optimization algorithm. - /// - /// - /// Value of momenta used in the Momentum optimization algorithm. - /// - /// - /// Value of gradient_accumulators used in the Momentum optimization algorithm. - /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'LoadTPUEmbeddingMomentumParametersGradAccumDebug'. - /// - /// - /// Optional argument - /// - /// + /// /// Optional argument /// /// @@ -22886,12 +24665,11 @@ public TFOperation LoadTPUEmbeddingMomentumParameters (TFOutput parameters, TFOu /// parameters that are loaded from a checkpoint before a training loop is /// executed. /// - public TFOperation LoadTPUEmbeddingMomentumParametersGradAccumDebug (TFOutput parameters, TFOutput momenta, TFOutput gradient_accumulators, long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) + public TFOperation LoadTPUEmbeddingMomentumParameters (TFOutput parameters, TFOutput momenta, long num_shards, long shard_id, long? table_id = null, string table_name = null, string config = null, string operName = null) { - var desc = new TFOperationDesc (this, "LoadTPUEmbeddingMomentumParametersGradAccumDebug", MakeName ("LoadTPUEmbeddingMomentumParametersGradAccumDebug", operName)); + var desc = new TFOperationDesc (this, "LoadTPUEmbeddingMomentumParameters", MakeName ("LoadTPUEmbeddingMomentumParameters", operName)); desc.AddInput (parameters); desc.AddInput (momenta); - desc.AddInput (gradient_accumulators); foreach ( TFOperation control in CurrentDependencies ) desc.AddControlInput (control); @@ -22903,6 +24681,9 @@ public TFOperation LoadTPUEmbeddingMomentumParametersGradAccumDebug (TFOutput pa if (table_name != null) desc.SetAttr ("table_name", table_name); + if (config != null) + desc.SetAttr ("config", config); + var op = desc.FinishOperation (); return op; } @@ -22925,59 +24706,7 @@ public TFOperation LoadTPUEmbeddingMomentumParametersGradAccumDebug (TFOutput pa /// /// Optional argument /// - /// - /// - /// - /// - /// - /// Returns the description of the operation - /// - /// - /// An op that loads optimization parameters into HBM for embedding. Must be - /// preceded by a ConfigureTPUEmbeddingHost op that sets up the correct - /// embedding table configuration. For example, this op is used to install - /// parameters that are loaded from a checkpoint before a training loop is - /// executed. - /// - public TFOperation LoadTPUEmbeddingProximalAdagradParameters (TFOutput parameters, TFOutput accumulators, long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) - { - var desc = new TFOperationDesc (this, "LoadTPUEmbeddingProximalAdagradParameters", MakeName ("LoadTPUEmbeddingProximalAdagradParameters", operName)); - desc.AddInput (parameters); - desc.AddInput (accumulators); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - desc.SetAttr ("num_shards", num_shards); - desc.SetAttr ("shard_id", shard_id); - if (table_id.HasValue) - desc.SetAttr ("table_id", table_id.Value); - - if (table_name != null) - desc.SetAttr ("table_name", table_name); - - var op = desc.FinishOperation (); - return op; - } - - /// - /// Load proximal Adagrad embedding parameters with debug support. - /// - /// - /// Value of parameters used in the proximal Adagrad optimization algorithm. - /// - /// - /// Value of accumulators used in the proximal Adagrad optimization algorithm. - /// - /// - /// Value of gradient_accumulators used in the proximal Adagrad optimization algorithm. - /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'LoadTPUEmbeddingProximalAdagradParametersGradAccumDebug'. - /// - /// - /// Optional argument - /// - /// + /// /// Optional argument /// /// @@ -22994,12 +24723,11 @@ public TFOperation LoadTPUEmbeddingProximalAdagradParameters (TFOutput parameter /// parameters that are loaded from a checkpoint before a training loop is /// executed. /// - public TFOperation LoadTPUEmbeddingProximalAdagradParametersGradAccumDebug (TFOutput parameters, TFOutput accumulators, TFOutput gradient_accumulators, long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) + public TFOperation LoadTPUEmbeddingProximalAdagradParameters (TFOutput parameters, TFOutput accumulators, long num_shards, long shard_id, long? table_id = null, string table_name = null, string config = null, string operName = null) { - var desc = new TFOperationDesc (this, "LoadTPUEmbeddingProximalAdagradParametersGradAccumDebug", MakeName ("LoadTPUEmbeddingProximalAdagradParametersGradAccumDebug", operName)); + var desc = new TFOperationDesc (this, "LoadTPUEmbeddingProximalAdagradParameters", MakeName ("LoadTPUEmbeddingProximalAdagradParameters", operName)); desc.AddInput (parameters); desc.AddInput (accumulators); - desc.AddInput (gradient_accumulators); foreach ( TFOperation control in CurrentDependencies ) desc.AddControlInput (control); @@ -23011,6 +24739,9 @@ public TFOperation LoadTPUEmbeddingProximalAdagradParametersGradAccumDebug (TFOu if (table_name != null) desc.SetAttr ("table_name", table_name); + if (config != null) + desc.SetAttr ("config", config); + var op = desc.FinishOperation (); return op; } @@ -23036,63 +24767,7 @@ public TFOperation LoadTPUEmbeddingProximalAdagradParametersGradAccumDebug (TFOu /// /// Optional argument /// - /// - /// - /// - /// - /// - /// Returns the description of the operation - /// - /// - /// An op that loads optimization parameters into HBM for embedding. Must be - /// preceded by a ConfigureTPUEmbeddingHost op that sets up the correct - /// embedding table configuration. For example, this op is used to install - /// parameters that are loaded from a checkpoint before a training loop is - /// executed. - /// - public TFOperation LoadTPUEmbeddingRMSPropParameters (TFOutput parameters, TFOutput ms, TFOutput mom, long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) - { - var desc = new TFOperationDesc (this, "LoadTPUEmbeddingRMSPropParameters", MakeName ("LoadTPUEmbeddingRMSPropParameters", operName)); - desc.AddInput (parameters); - desc.AddInput (ms); - desc.AddInput (mom); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - desc.SetAttr ("num_shards", num_shards); - desc.SetAttr ("shard_id", shard_id); - if (table_id.HasValue) - desc.SetAttr ("table_id", table_id.Value); - - if (table_name != null) - desc.SetAttr ("table_name", table_name); - - var op = desc.FinishOperation (); - return op; - } - - /// - /// Load RMSProp embedding parameters with debug support. - /// - /// - /// Value of parameters used in the RMSProp optimization algorithm. - /// - /// - /// Value of ms used in the RMSProp optimization algorithm. - /// - /// - /// Value of mom used in the RMSProp optimization algorithm. - /// - /// - /// Value of gradient_accumulators used in the RMSProp optimization algorithm. - /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'LoadTPUEmbeddingRMSPropParametersGradAccumDebug'. - /// - /// - /// Optional argument - /// - /// + /// /// Optional argument /// /// @@ -23109,13 +24784,12 @@ public TFOperation LoadTPUEmbeddingRMSPropParameters (TFOutput parameters, TFOut /// parameters that are loaded from a checkpoint before a training loop is /// executed. /// - public TFOperation LoadTPUEmbeddingRMSPropParametersGradAccumDebug (TFOutput parameters, TFOutput ms, TFOutput mom, TFOutput gradient_accumulators, long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) + public TFOperation LoadTPUEmbeddingRMSPropParameters (TFOutput parameters, TFOutput ms, TFOutput mom, long num_shards, long shard_id, long? table_id = null, string table_name = null, string config = null, string operName = null) { - var desc = new TFOperationDesc (this, "LoadTPUEmbeddingRMSPropParametersGradAccumDebug", MakeName ("LoadTPUEmbeddingRMSPropParametersGradAccumDebug", operName)); + var desc = new TFOperationDesc (this, "LoadTPUEmbeddingRMSPropParameters", MakeName ("LoadTPUEmbeddingRMSPropParameters", operName)); desc.AddInput (parameters); desc.AddInput (ms); desc.AddInput (mom); - desc.AddInput (gradient_accumulators); foreach ( TFOperation control in CurrentDependencies ) desc.AddControlInput (control); @@ -23127,6 +24801,9 @@ public TFOperation LoadTPUEmbeddingRMSPropParametersGradAccumDebug (TFOutput par if (table_name != null) desc.SetAttr ("table_name", table_name); + if (config != null) + desc.SetAttr ("config", config); + var op = desc.FinishOperation (); return op; } @@ -23146,6 +24823,9 @@ public TFOperation LoadTPUEmbeddingRMSPropParametersGradAccumDebug (TFOutput par /// /// Optional argument /// + /// + /// Optional argument + /// /// /// /// @@ -23160,7 +24840,7 @@ public TFOperation LoadTPUEmbeddingRMSPropParametersGradAccumDebug (TFOutput par /// parameters that are loaded from a checkpoint before a training loop is /// executed. /// - public TFOperation LoadTPUEmbeddingStochasticGradientDescentParameters (TFOutput parameters, long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) + public TFOperation LoadTPUEmbeddingStochasticGradientDescentParameters (TFOutput parameters, long num_shards, long shard_id, long? table_id = null, string table_name = null, string config = null, string operName = null) { var desc = new TFOperationDesc (this, "LoadTPUEmbeddingStochasticGradientDescentParameters", MakeName ("LoadTPUEmbeddingStochasticGradientDescentParameters", operName)); desc.AddInput (parameters); @@ -23175,6 +24855,9 @@ public TFOperation LoadTPUEmbeddingStochasticGradientDescentParameters (TFOutput if (table_name != null) desc.SetAttr ("table_name", table_name); + if (config != null) + desc.SetAttr ("config", config); + var op = desc.FinishOperation (); return op; } @@ -23279,14 +24962,16 @@ public TFOutput LogicalAnd (TFOutput x, TFOutput y, string operName = null) } /// - /// Returns the truth value of NOT x element-wise. + /// Returns the truth value of NOT x element-wise. /// /// + /// A Tensor of type bool. /// /// /// If specified, the created operation in the graph will be this one, otherwise it will be named 'LogicalNot'. /// /// + /// A Tensor of type bool with the same shape as x. The logical negation of x. /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// public TFOutput LogicalNot (TFOutput x, string operName = null) @@ -23355,9 +25040,9 @@ public TFOutput LogicalOr (TFOutput x, TFOutput y, string operName = null) /// The input is a tensor of shape [N, M, M] whose inner-most 2 dimensions /// form square matrices. The outputs are two tensors containing the signs and /// absolute values of the log determinants for all N input submatrices - /// [..., :, :] such that the determinant = sign*exp(log_abs_determinant). - /// The log_abs_determinant is computed as det(P)*sum(log(diag(LU))) where LU - /// is the LU decomposition of the input and P is the corresponding + /// [..., :, :] such that determinant = sign*exp(log_abs_determinant). + /// The log_abs_determinant is computed as det(P)*sum(log(diag(LU))) where LU + /// is the LU decomposition of the input and P is the corresponding /// permutation matrix. /// public (TFOutput sign, TFOutput log_abs_determinant) LogMatrixDeterminant (TFOutput input, string operName = null) @@ -24389,108 +26074,40 @@ public TFOperation MakeIterator (TFOutput dataset, TFOutput iterator, string ope } /// - /// Op removes all elements in the underlying container. + /// Make all elements in the non-Batch dimension unique, but \"close\" to /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'MapClear'. - /// - /// - /// Optional argument - /// - /// - /// Optional argument - /// - /// - /// Optional argument - /// - /// - /// Optional argument - /// - /// + /// /// - /// - /// Returns the description of the operation - /// - public TFOperation MapClear (TFDataType[] dtypes, long? capacity = null, long? memory_limit = null, string container = null, string shared_name = null, string operName = null) - { - var desc = new TFOperationDesc (this, "MapClear", MakeName ("MapClear", operName)); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - desc.SetAttrType ("dtypes", dtypes); - if (capacity.HasValue) - desc.SetAttr ("capacity", capacity.Value); - - if (memory_limit.HasValue) - desc.SetAttr ("memory_limit", memory_limit.Value); - - if (container != null) - desc.SetAttr ("container", container); - - if (shared_name != null) - desc.SetAttr ("shared_name", shared_name); - - var op = desc.FinishOperation (); - return op; - } - - /// - /// Op returns the number of incomplete elements in the underlying container. - /// /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'MapIncompleteSize'. - /// - /// - /// Optional argument - /// - /// - /// Optional argument - /// - /// - /// Optional argument - /// - /// - /// Optional argument - /// - /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'MakeUnique'. /// /// /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// - public TFOutput MapIncompleteSize (TFDataType[] dtypes, long? capacity = null, long? memory_limit = null, string container = null, string shared_name = null, string operName = null) + /// + /// their initial value. Never returns a sub-normal number. Never returns + /// zero. The sign of each input element is always identical to the sign + /// of the corresponding output element. Behavior for infinite elements is + /// undefined. Behavior for subnormal elements is undefined. + /// + public TFOutput MakeUnique (TFOutput input, string operName = null) { - var desc = new TFOperationDesc (this, "MapIncompleteSize", MakeName ("MapIncompleteSize", operName)); + var desc = new TFOperationDesc (this, "MakeUnique", MakeName ("MakeUnique", operName)); + desc.AddInput (input); foreach ( TFOperation control in CurrentDependencies ) desc.AddControlInput (control); - desc.SetAttrType ("dtypes", dtypes); - if (capacity.HasValue) - desc.SetAttr ("capacity", capacity.Value); - - if (memory_limit.HasValue) - desc.SetAttr ("memory_limit", memory_limit.Value); - - if (container != null) - desc.SetAttr ("container", container); - - if (shared_name != null) - desc.SetAttr ("shared_name", shared_name); - var op = desc.FinishOperation (); int _idx = 0; - var size = new TFOutput (op, _idx++); - return size; + var output = new TFOutput (op, _idx++); + return output; } /// - /// Op peeks at the values at the specified key. If the + /// Op removes all elements in the underlying container. /// - /// - /// - /// - /// /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'MapPeek'. + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'MapClear'. /// /// /// Optional argument @@ -24507,17 +26124,11 @@ public TFOutput MapIncompleteSize (TFDataType[] dtypes, long? capacity = null, l /// /// /// - /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// Returns the description of the operation /// - /// - /// underlying container does not contain this key - /// this op will block until it does. - /// - public TFOutput[] MapPeek (TFOutput key, TFOutput indices, TFDataType[] dtypes, long? capacity = null, long? memory_limit = null, string container = null, string shared_name = null, string operName = null) + public TFOperation MapClear (TFDataType[] dtypes, long? capacity = null, long? memory_limit = null, string container = null, string shared_name = null, string operName = null) { - var desc = new TFOperationDesc (this, "MapPeek", MakeName ("MapPeek", operName)); - desc.AddInput (key); - desc.AddInput (indices); + var desc = new TFOperationDesc (this, "MapClear", MakeName ("MapClear", operName)); foreach ( TFOperation control in CurrentDependencies ) desc.AddControlInput (control); @@ -24535,21 +26146,14 @@ public TFOutput[] MapPeek (TFOutput key, TFOutput indices, TFDataType[] dtypes, desc.SetAttr ("shared_name", shared_name); var op = desc.FinishOperation (); - int _idx = 0; - int _n = 0; - _n = op.OutputListLength ("values"); - var values = new TFOutput [_n]; - for (int i = 0; i < _n; i++) - values [i] = new TFOutput (op, _idx++); - - return values; + return op; } /// - /// Op returns the number of elements in the underlying container. + /// Op returns the number of incomplete elements in the underlying container. /// /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'MapSize'. + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'MapIncompleteSize'. /// /// /// Optional argument @@ -24568,9 +26172,120 @@ public TFOutput[] MapPeek (TFOutput key, TFOutput indices, TFDataType[] dtypes, /// /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// - public TFOutput MapSize (TFDataType[] dtypes, long? capacity = null, long? memory_limit = null, string container = null, string shared_name = null, string operName = null) + public TFOutput MapIncompleteSize (TFDataType[] dtypes, long? capacity = null, long? memory_limit = null, string container = null, string shared_name = null, string operName = null) { - var desc = new TFOperationDesc (this, "MapSize", MakeName ("MapSize", operName)); + var desc = new TFOperationDesc (this, "MapIncompleteSize", MakeName ("MapIncompleteSize", operName)); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("dtypes", dtypes); + if (capacity.HasValue) + desc.SetAttr ("capacity", capacity.Value); + + if (memory_limit.HasValue) + desc.SetAttr ("memory_limit", memory_limit.Value); + + if (container != null) + desc.SetAttr ("container", container); + + if (shared_name != null) + desc.SetAttr ("shared_name", shared_name); + + var op = desc.FinishOperation (); + int _idx = 0; + var size = new TFOutput (op, _idx++); + return size; + } + + /// + /// Op peeks at the values at the specified key. If the + /// + /// + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'MapPeek'. + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// underlying container does not contain this key + /// this op will block until it does. + /// + public TFOutput[] MapPeek (TFOutput key, TFOutput indices, TFDataType[] dtypes, long? capacity = null, long? memory_limit = null, string container = null, string shared_name = null, string operName = null) + { + var desc = new TFOperationDesc (this, "MapPeek", MakeName ("MapPeek", operName)); + desc.AddInput (key); + desc.AddInput (indices); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("dtypes", dtypes); + if (capacity.HasValue) + desc.SetAttr ("capacity", capacity.Value); + + if (memory_limit.HasValue) + desc.SetAttr ("memory_limit", memory_limit.Value); + + if (container != null) + desc.SetAttr ("container", container); + + if (shared_name != null) + desc.SetAttr ("shared_name", shared_name); + + var op = desc.FinishOperation (); + int _idx = 0; + int _n = 0; + _n = op.OutputListLength ("values"); + var values = new TFOutput [_n]; + for (int i = 0; i < _n; i++) + values [i] = new TFOutput (op, _idx++); + + return values; + } + + /// + /// Op returns the number of elements in the underlying container. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'MapSize'. + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + public TFOutput MapSize (TFDataType[] dtypes, long? capacity = null, long? memory_limit = null, string container = null, string shared_name = null, string operName = null) + { + var desc = new TFOperationDesc (this, "MapSize", MakeName ("MapSize", operName)); foreach ( TFOperation control in CurrentDependencies ) desc.AddControlInput (control); @@ -24865,7 +26580,7 @@ public TFOutput MatMul (TFOutput a, TFOutput b, bool? transpose_a = null, bool? } /// - /// Copy a tensor setting everything outside a central band in each innermost matrix + /// Copy a tensor setting everything outside a central band in each innermost matrix to zero. /// /// /// Rank k tensor. @@ -24886,8 +26601,6 @@ public TFOutput MatMul (TFOutput a, TFOutput b, bool? transpose_a = null, bool? /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// /// - /// to zero. - /// /// The band part is computed as follows: /// Assume input has k dimensions [I, J, K, ..., M, N], then the output is a /// tensor with the same shape where @@ -24903,16 +26616,16 @@ public TFOutput MatMul (TFOutput a, TFOutput b, bool? transpose_a = null, bool? /// /// /// # if 'input' is [[ 0, 1, 2, 3] - /// [-1, 0, 1, 2] - /// [-2, -1, 0, 1] - /// [-3, -2, -1, 0]], + /// # [-1, 0, 1, 2] + /// # [-2, -1, 0, 1] + /// # [-3, -2, -1, 0]], /// - /// tf.matrix_band_part(input, 1, -1) ==&gt; [[ 0, 1, 2, 3] + /// tf.linalg.band_part(input, 1, -1) ==&gt; [[ 0, 1, 2, 3] /// [-1, 0, 1, 2] /// [ 0, -1, 0, 1] /// [ 0, 0, -1, 0]], /// - /// tf.matrix_band_part(input, 2, 1) ==&gt; [[ 0, 1, 0, 0] + /// tf.linalg.band_part(input, 2, 1) ==&gt; [[ 0, 1, 0, 0] /// [-1, 0, 1, 0] /// [-2, -1, 0, 1] /// [ 0, -2, -1, 0]] @@ -24921,9 +26634,9 @@ public TFOutput MatMul (TFOutput a, TFOutput b, bool? transpose_a = null, bool? /// Useful special cases: /// /// - /// tf.matrix_band_part(input, 0, -1) ==&gt; Upper triangular part. - /// tf.matrix_band_part(input, -1, 0) ==&gt; Lower triangular part. - /// tf.matrix_band_part(input, 0, 0) ==&gt; Diagonal. + /// tf.linalg.band_part(input, 0, -1) ==&gt; Upper triangular part. + /// tf.linalg.band_part(input, -1, 0) ==&gt; Lower triangular part. + /// tf.linalg.band_part(input, 0, 0) ==&gt; Diagonal. /// /// public TFOutput MatrixBandPart (TFOutput input, TFOutput num_lower, TFOutput num_upper, string operName = null) @@ -25191,6 +26904,158 @@ public TFOutput MatrixDiagPartV2 (TFOutput input, TFOutput k, TFOutput padding_v return diagonal; } + /// + /// Returns the batched diagonal part of a batched tensor. + /// + /// + /// Rank r tensor where r &gt;= 2. + /// + /// + /// Diagonal offset(s). Positive value means superdiagonal, 0 refers to the main + /// diagonal, and negative value means subdiagonals. k can be a single integer + /// (for a single diagonal) or a pair of integers specifying the low and high ends + /// of a matrix band. k[0] must not be larger than k[1]. + /// + /// + /// The value to fill the area outside the specified diagonal band with. + /// Default is 0. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'MatrixDiagPartV3'. + /// + /// + /// Optional argument + /// Some diagonals are shorter than max_diag_len and need to be padded. align is + /// a string specifying how superdiagonals and subdiagonals should be aligned, + /// respectively. There are four possible alignments: "RIGHT_LEFT" (default), + /// "LEFT_RIGHT", "LEFT_LEFT", and "RIGHT_RIGHT". "RIGHT_LEFT" aligns superdiagonals + /// to the right (left-pads the row) and subdiagonals to the left (right-pads the + /// row). It is the packing format LAPACK uses. cuSPARSE uses "LEFT_RIGHT", which is + /// the opposite alignment. + /// + /// + /// The extracted diagonal(s). + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Returns a tensor with the k[0]-th to k[1]-th diagonals of the batched + /// input. + /// + /// Assume input has r dimensions [I, J, ..., L, M, N]. + /// Let max_diag_len be the maximum length among all diagonals to be extracted, + /// max_diag_len = min(M + min(k[1], 0), N + min(-k[0], 0)) + /// Let num_diags be the number of diagonals to extract, + /// num_diags = k[1] - k[0] + 1. + /// + /// If num_diags == 1, the output tensor is of rank r - 1 with shape + /// [I, J, ..., L, max_diag_len] and values: + /// + /// + /// diagonal[i, j, ..., l, n] + /// = input[i, j, ..., l, n+y, n+x] ; if 0 &lt;= n+y &lt; M and 0 &lt;= n+x &lt; N, + /// padding_value ; otherwise. + /// + /// where y = max(-k[1], 0), x = max(k[1], 0). + /// + /// Otherwise, the output tensor has rank r with dimensions + /// [I, J, ..., L, num_diags, max_diag_len] with values: + /// + /// + /// diagonal[i, j, ..., l, m, n] + /// = input[i, j, ..., l, n+y, n+x] ; if 0 &lt;= n+y &lt; M and 0 &lt;= n+x &lt; N, + /// padding_value ; otherwise. + /// + /// where d = k[1] - m, y = max(-d, 0) - offset, and x = max(d, 0) - offset. + /// + /// offset is zero except when the alignment of the diagonal is to the right. + /// + /// offset = max_diag_len - diag_len(d) ; if (align in {RIGHT_LEFT, RIGHT_RIGHT} + /// and d &gt;= 0) or + /// (align in {LEFT_RIGHT, RIGHT_RIGHT} + /// and d &lt;= 0) + /// 0 ; otherwise + /// + /// where diag_len(d) = min(cols - max(d, 0), rows + min(d, 0)). + /// + /// The input must be at least a matrix. + /// + /// For example: + /// + /// + /// input = np.array([[[1, 2, 3, 4], # Input shape: (2, 3, 4) + /// [5, 6, 7, 8], + /// [9, 8, 7, 6]], + /// [[5, 4, 3, 2], + /// [1, 2, 3, 4], + /// [5, 6, 7, 8]]]) + /// + /// # A main diagonal from each batch. + /// tf.matrix_diag_part(input) ==&gt; [[1, 6, 7], # Output shape: (2, 3) + /// [5, 2, 7]] + /// + /// # A superdiagonal from each batch. + /// tf.matrix_diag_part(input, k = 1) + /// ==&gt; [[2, 7, 6], # Output shape: (2, 3) + /// [4, 3, 8]] + /// + /// # A band from each batch. + /// tf.matrix_diag_part(input, k = (-1, 2)) + /// ==&gt; [[[0, 3, 8], # Output shape: (2, 4, 3) + /// [2, 7, 6], + /// [1, 6, 7], + /// [5, 8, 0]], + /// [[0, 3, 4], + /// [4, 3, 8], + /// [5, 2, 7], + /// [1, 6, 0]]] + /// + /// # LEFT_RIGHT alignment. + /// tf.matrix_diag_part(input, k = (-1, 2), align="LEFT_RIGHT") + /// ==&gt; [[[3, 8, 0], # Output shape: (2, 4, 3) + /// [2, 7, 6], + /// [1, 6, 7], + /// [0, 5, 8]], + /// [[3, 4, 0], + /// [4, 3, 8], + /// [5, 2, 7], + /// [0, 1, 6]]] + /// + /// # max_diag_len can be shorter than the main diagonal. + /// tf.matrix_diag_part(input, k = (-2, -1)) + /// ==&gt; [[[5, 8], + /// [9, 0]], + /// [[1, 6], + /// [5, 0]]] + /// + /// # padding_value = 9 + /// tf.matrix_diag_part(input, k = (1, 3), padding_value = 9) + /// ==&gt; [[[9, 9, 4], # Output shape: (2, 3, 3) + /// [9, 3, 8], + /// [2, 7, 6]], + /// [[9, 9, 2], + /// [9, 3, 4], + /// [4, 3, 8]]] + /// + /// + /// + public TFOutput MatrixDiagPartV3 (TFOutput input, TFOutput k, TFOutput padding_value, string align = null, string operName = null) + { + var desc = new TFOperationDesc (this, "MatrixDiagPartV3", MakeName ("MatrixDiagPartV3", operName)); + desc.AddInput (input); + desc.AddInput (k); + desc.AddInput (padding_value); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (align != null) + desc.SetAttr ("align", align); + + var op = desc.FinishOperation (); + int _idx = 0; + var diagonal = new TFOutput (op, _idx++); + return diagonal; + } + /// /// Returns a batched diagonal tensor with given batched diagonal values. /// @@ -25330,6 +27195,187 @@ public TFOutput MatrixDiagV2 (TFOutput diagonal, TFOutput k, TFOutput num_rows, return output; } + /// + /// Returns a batched diagonal tensor with given batched diagonal values. + /// + /// + /// Rank r, where r &gt;= 1 + /// + /// + /// Diagonal offset(s). Positive value means superdiagonal, 0 refers to the main + /// diagonal, and negative value means subdiagonals. k can be a single integer + /// (for a single diagonal) or a pair of integers specifying the low and high ends + /// of a matrix band. k[0] must not be larger than k[1]. + /// + /// + /// The number of rows of the output matrix. If it is not provided, the op assumes + /// the output matrix is a square matrix and infers the matrix size from k and the + /// innermost dimension of diagonal. + /// + /// + /// The number of columns of the output matrix. If it is not provided, the op + /// assumes the output matrix is a square matrix and infers the matrix size from + /// k and the innermost dimension of diagonal. + /// + /// + /// The number to fill the area outside the specified diagonal band with. + /// Default is 0. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'MatrixDiagV3'. + /// + /// + /// Optional argument + /// Some diagonals are shorter than max_diag_len and need to be padded. align is + /// a string specifying how superdiagonals and subdiagonals should be aligned, + /// respectively. There are four possible alignments: "RIGHT_LEFT" (default), + /// "LEFT_RIGHT", "LEFT_LEFT", and "RIGHT_RIGHT". "RIGHT_LEFT" aligns superdiagonals + /// to the right (left-pads the row) and subdiagonals to the left (right-pads the + /// row). It is the packing format LAPACK uses. cuSPARSE uses "LEFT_RIGHT", which is + /// the opposite alignment. + /// + /// + /// Has rank r+1 when k is an integer or k[0] == k[1], rank r otherwise. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Returns a tensor with the contents in diagonal as k[0]-th to k[1]-th + /// diagonals of a matrix, with everything else padded with padding. num_rows + /// and num_cols specify the dimension of the innermost matrix of the output. If + /// both are not specified, the op assumes the innermost matrix is square and infers + /// its size from k and the innermost dimension of diagonal. If only one of them + /// is specified, the op assumes the unspecified value is the smallest possible + /// based on other criteria. + /// + /// Let diagonal have r dimensions [I, J, ..., L, M, N]. The output tensor has + /// rank r+1 with shape [I, J, ..., L, M, num_rows, num_cols] when only one + /// diagonal is given (k is an integer or k[0] == k[1]). Otherwise, it has rank + /// r with shape [I, J, ..., L, num_rows, num_cols]. + /// + /// The second innermost dimension of diagonal has double meaning. + /// When k is scalar or k[0] == k[1], M is part of the batch size + /// [I, J, ..., M], and the output tensor is: + /// + /// + /// output[i, j, ..., l, m, n] + /// = diagonal[i, j, ..., l, n-max(d_upper, 0)] ; if n - m == d_upper + /// padding_value ; otherwise + /// + /// + /// Otherwise, M is treated as the number of diagonals for the matrix in the + /// same batch (M = k[1]-k[0]+1), and the output tensor is: + /// + /// + /// output[i, j, ..., l, m, n] + /// = diagonal[i, j, ..., l, diag_index, index_in_diag] ; if k[0] &lt;= d &lt;= k[1] + /// padding_value ; otherwise + /// + /// where d = n - m, diag_index = [k] - d, and + /// index_in_diag = n - max(d, 0) + offset. + /// + /// offset is zero except when the alignment of the diagonal is to the right. + /// + /// offset = max_diag_len - diag_len(d) ; if (align in {RIGHT_LEFT, RIGHT_RIGHT} + /// and d &gt;= 0) or + /// (align in {LEFT_RIGHT, RIGHT_RIGHT} + /// and d &lt;= 0) + /// 0 ; otherwise + /// + /// where diag_len(d) = min(cols - max(d, 0), rows + min(d, 0)). + /// + /// For example: + /// + /// + /// # The main diagonal. + /// diagonal = np.array([[1, 2, 3, 4], # Input shape: (2, 4) + /// [5, 6, 7, 8]]) + /// tf.matrix_diag(diagonal) ==&gt; [[[1, 0, 0, 0], # Output shape: (2, 4, 4) + /// [0, 2, 0, 0], + /// [0, 0, 3, 0], + /// [0, 0, 0, 4]], + /// [[5, 0, 0, 0], + /// [0, 6, 0, 0], + /// [0, 0, 7, 0], + /// [0, 0, 0, 8]]] + /// + /// # A superdiagonal (per batch). + /// diagonal = np.array([[1, 2, 3], # Input shape: (2, 3) + /// [4, 5, 6]]) + /// tf.matrix_diag(diagonal, k = 1) + /// ==&gt; [[[0, 1, 0, 0], # Output shape: (2, 4, 4) + /// [0, 0, 2, 0], + /// [0, 0, 0, 3], + /// [0, 0, 0, 0]], + /// [[0, 4, 0, 0], + /// [0, 0, 5, 0], + /// [0, 0, 0, 6], + /// [0, 0, 0, 0]]] + /// + /// # A tridiagonal band (per batch). + /// diagonals = np.array([[[0, 8, 9], # Input shape: (2, 2, 3) + /// [1, 2, 3], + /// [4, 5, 0]], + /// [[0, 2, 3], + /// [6, 7, 9], + /// [9, 1, 0]]]) + /// tf.matrix_diag(diagonals, k = (-1, 1)) + /// ==&gt; [[[1, 8, 0], # Output shape: (2, 3, 3) + /// [4, 2, 9], + /// [0, 5, 3]], + /// [[6, 2, 0], + /// [9, 7, 3], + /// [0, 1, 9]]] + /// + /// # LEFT_RIGHT alignment. + /// diagonals = np.array([[[8, 9, 0], # Input shape: (2, 2, 3) + /// [1, 2, 3], + /// [0, 4, 5]], + /// [[2, 3, 0], + /// [6, 7, 9], + /// [0, 9, 1]]]) + /// tf.matrix_diag(diagonals, k = (-1, 1), align="LEFT_RIGHT") + /// ==&gt; [[[1, 8, 0], # Output shape: (2, 3, 3) + /// [4, 2, 9], + /// [0, 5, 3]], + /// [[6, 2, 0], + /// [9, 7, 3], + /// [0, 1, 9]]] + /// + /// # Rectangular matrix. + /// diagonal = np.array([1, 2]) # Input shape: (2) + /// tf.matrix_diag(diagonal, k = -1, num_rows = 3, num_cols = 4) + /// ==&gt; [[0, 0, 0, 0], # Output shape: (3, 4) + /// [1, 0, 0, 0], + /// [0, 2, 0, 0]] + /// + /// # Rectangular matrix with inferred num_cols and padding_value = 9. + /// tf.matrix_diag(diagonal, k = -1, num_rows = 3, padding_value = 9) + /// ==&gt; [[9, 9], # Output shape: (3, 2) + /// [1, 9], + /// [9, 2]] + /// + /// + /// + public TFOutput MatrixDiagV3 (TFOutput diagonal, TFOutput k, TFOutput num_rows, TFOutput num_cols, TFOutput padding_value, string align = null, string operName = null) + { + var desc = new TFOperationDesc (this, "MatrixDiagV3", MakeName ("MatrixDiagV3", operName)); + desc.AddInput (diagonal); + desc.AddInput (k); + desc.AddInput (num_rows); + desc.AddInput (num_cols); + desc.AddInput (padding_value); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (align != null) + desc.SetAttr ("align", align); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + /// /// Deprecated, use python implementation tf.linalg.matrix_exponential. /// @@ -25355,7 +27401,7 @@ public TFOutput MatrixExponential (TFOutput input, string operName = null) } /// - /// Computes the inverse of one or more square invertible matrices or their + /// Computes the inverse of one or more square invertible matrices or their adjoints (conjugate transposes). /// /// /// Shape is [..., M, M]. @@ -25375,7 +27421,6 @@ public TFOutput MatrixExponential (TFOutput input, string operName = null) /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// /// - /// adjoints (conjugate transposes). /// /// The input is a tensor of shape [..., M, M] whose inner-most 2 dimensions /// form square matrices. The output is a tensor of the same shape as the input @@ -25605,6 +27650,163 @@ public TFOutput MatrixSetDiagV2 (TFOutput input, TFOutput diagonal, TFOutput k, return output; } + /// + /// Returns a batched matrix tensor with new batched diagonal values. + /// + /// + /// Rank r+1, where r &gt;= 1. + /// + /// + /// Rank r when k is an integer or k[0] == k[1]. Otherwise, it has rank r+1. + /// k &gt;= 1. + /// + /// + /// Diagonal offset(s). Positive value means superdiagonal, 0 refers to the main + /// diagonal, and negative value means subdiagonals. k can be a single integer + /// (for a single diagonal) or a pair of integers specifying the low and high ends + /// of a matrix band. k[0] must not be larger than k[1]. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'MatrixSetDiagV3'. + /// + /// + /// Optional argument + /// Some diagonals are shorter than max_diag_len and need to be padded. align is + /// a string specifying how superdiagonals and subdiagonals should be aligned, + /// respectively. There are four possible alignments: "RIGHT_LEFT" (default), + /// "LEFT_RIGHT", "LEFT_LEFT", and "RIGHT_RIGHT". "RIGHT_LEFT" aligns superdiagonals + /// to the right (left-pads the row) and subdiagonals to the left (right-pads the + /// row). It is the packing format LAPACK uses. cuSPARSE uses "LEFT_RIGHT", which is + /// the opposite alignment. + /// + /// + /// Rank r+1, with output.shape = input.shape. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Given input and diagonal, this operation returns a tensor with the + /// same shape and values as input, except for the specified diagonals of the + /// innermost matrices. These will be overwritten by the values in diagonal. + /// + /// input has r+1 dimensions [I, J, ..., L, M, N]. When k is scalar or + /// k[0] == k[1], diagonal has r dimensions [I, J, ..., L, max_diag_len]. + /// Otherwise, it has r+1 dimensions [I, J, ..., L, num_diags, max_diag_len]. + /// num_diags is the number of diagonals, num_diags = k[1] - k[0] + 1. + /// max_diag_len is the longest diagonal in the range [k[0], k[1]], + /// max_diag_len = min(M + min(k[1], 0), N + min(-k[0], 0)) + /// + /// The output is a tensor of rank k+1 with dimensions [I, J, ..., L, M, N]. + /// If k is scalar or k[0] == k[1]: + /// + /// + /// output[i, j, ..., l, m, n] + /// = diagonal[i, j, ..., l, n-max(k[1], 0)] ; if n - m == k[1] + /// input[i, j, ..., l, m, n] ; otherwise + /// + /// + /// Otherwise, + /// + /// + /// output[i, j, ..., l, m, n] + /// = diagonal[i, j, ..., l, diag_index, index_in_diag] ; if k[0] &lt;= d &lt;= k[1] + /// input[i, j, ..., l, m, n] ; otherwise + /// + /// where d = n - m, diag_index = k[1] - d, and + /// index_in_diag = n - max(d, 0) + offset. + /// + /// offset is zero except when the alignment of the diagonal is to the right. + /// + /// offset = max_diag_len - diag_len(d) ; if (align in {RIGHT_LEFT, RIGHT_RIGHT} + /// and d &gt;= 0) or + /// (align in {LEFT_RIGHT, RIGHT_RIGHT} + /// and d &lt;= 0) + /// 0 ; otherwise + /// + /// where diag_len(d) = min(cols - max(d, 0), rows + min(d, 0)). + /// + /// For example: + /// + /// + /// # The main diagonal. + /// input = np.array([[[7, 7, 7, 7], # Input shape: (2, 3, 4) + /// [7, 7, 7, 7], + /// [7, 7, 7, 7]], + /// [[7, 7, 7, 7], + /// [7, 7, 7, 7], + /// [7, 7, 7, 7]]]) + /// diagonal = np.array([[1, 2, 3], # Diagonal shape: (2, 3) + /// [4, 5, 6]]) + /// tf.matrix_set_diag(input, diagonal) + /// ==&gt; [[[1, 7, 7, 7], # Output shape: (2, 3, 4) + /// [7, 2, 7, 7], + /// [7, 7, 3, 7]], + /// [[4, 7, 7, 7], + /// [7, 5, 7, 7], + /// [7, 7, 6, 7]]] + /// + /// # A superdiagonal (per batch). + /// tf.matrix_set_diag(input, diagonal, k = 1) + /// ==&gt; [[[7, 1, 7, 7], # Output shape: (2, 3, 4) + /// [7, 7, 2, 7], + /// [7, 7, 7, 3]], + /// [[7, 4, 7, 7], + /// [7, 7, 5, 7], + /// [7, 7, 7, 6]]] + /// + /// # A band of diagonals. + /// diagonals = np.array([[[0, 9, 1], # Diagonal shape: (2, 4, 3) + /// [6, 5, 8], + /// [1, 2, 3], + /// [4, 5, 0]], + /// [[0, 1, 2], + /// [5, 6, 4], + /// [6, 1, 2], + /// [3, 4, 0]]]) + /// tf.matrix_set_diag(input, diagonals, k = (-1, 2)) + /// ==&gt; [[[1, 6, 9, 7], # Output shape: (2, 3, 4) + /// [4, 2, 5, 1], + /// [7, 5, 3, 8]], + /// [[6, 5, 1, 7], + /// [3, 1, 6, 2], + /// [7, 4, 2, 4]]] + /// + /// # LEFT_RIGHT alignment. + /// diagonals = np.array([[[9, 1, 0], # Diagonal shape: (2, 4, 3) + /// [6, 5, 8], + /// [1, 2, 3], + /// [0, 4, 5]], + /// [[1, 2, 0], + /// [5, 6, 4], + /// [6, 1, 2], + /// [0, 3, 4]]]) + /// tf.matrix_set_diag(input, diagonals, k = (-1, 2), align="LEFT_RIGHT") + /// ==&gt; [[[1, 6, 9, 7], # Output shape: (2, 3, 4) + /// [4, 2, 5, 1], + /// [7, 5, 3, 8]], + /// [[6, 5, 1, 7], + /// [3, 1, 6, 2], + /// [7, 4, 2, 4]]] + /// + /// + /// + public TFOutput MatrixSetDiagV3 (TFOutput input, TFOutput diagonal, TFOutput k, string align = null, string operName = null) + { + var desc = new TFOperationDesc (this, "MatrixSetDiagV3", MakeName ("MatrixSetDiagV3", operName)); + desc.AddInput (input); + desc.AddInput (diagonal); + desc.AddInput (k); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (align != null) + desc.SetAttr ("align", align); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + /// /// Solves systems of linear equations. /// @@ -25815,15 +28017,17 @@ public TFOutput MatrixSquareRoot (TFOutput input, string operName = null) /// of each inner-most matrix is assumed to be zero and not accessed. /// If lower is False then the strictly lower triangular part of each inner-most /// matrix is assumed to be zero and not accessed. - /// rhs is a tensor of shape [..., M, K]. + /// rhs is a tensor of shape [..., M, N]. /// - /// The output is a tensor of shape [..., M, K]. If adjoint is + /// The output is a tensor of shape [..., M, N]. If adjoint is /// True then the innermost matrices in output satisfy matrix equations /// matrix[..., :, :] * output[..., :, :] = rhs[..., :, :]. /// If adjoint is False then the strictly then the innermost matrices in /// output satisfy matrix equations /// adjoint(matrix[..., i, k]) * output[..., k, j] = rhs[..., i, j]. /// + /// Note, the batch shapes for the inputs only need to broadcast. + /// /// Example: /// /// @@ -25992,6 +28196,9 @@ public TFOutput MaxIntraOpParallelismDataset (TFOutput input_dataset, TFOutput m /// /// If specified, the created operation in the graph will be this one, otherwise it will be named 'MaxPool'. /// + /// + /// Optional argument + /// /// /// Optional argument /// Specify the data format of the input and output data. With the @@ -26014,7 +28221,7 @@ public TFOutput MaxIntraOpParallelismDataset (TFOutput input_dataset, TFOutput m /// The max pooled output tensor. /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// - public TFOutput MaxPool (TFOutput input, long[] ksize, long[] strides, string padding, string data_format = null, string operName = null) + public TFOutput MaxPool (TFOutput input, long[] ksize, long[] strides, string padding, long[] explicit_paddings = null, string data_format = null, string operName = null) { var desc = new TFOperationDesc (this, "MaxPool", MakeName ("MaxPool", operName)); desc.AddInput (input); @@ -26024,6 +28231,9 @@ public TFOutput MaxPool (TFOutput input, long[] ksize, long[] strides, string pa desc.SetAttr ("ksize", ksize); desc.SetAttr ("strides", strides); desc.SetAttr ("padding", padding); + if (explicit_paddings != null) + desc.SetAttr ("explicit_paddings", explicit_paddings); + if (data_format != null) desc.SetAttr ("data_format", data_format); @@ -26085,7 +28295,7 @@ public TFOutput MaxPool3D (TFOutput input, long[] ksize, long[] strides, string } /// - /// Computes gradients of max pooling function. + /// Computes gradients of 3D max pooling function. /// /// /// The original input tensor. @@ -26216,6 +28426,9 @@ public TFOutput MaxPool3DGradGrad (TFOutput orig_input, TFOutput orig_output, TF /// /// If specified, the created operation in the graph will be this one, otherwise it will be named 'MaxPoolGrad'. /// + /// + /// Optional argument + /// /// /// Optional argument /// Specify the data format of the input and output data. With the @@ -26238,7 +28451,7 @@ public TFOutput MaxPool3DGradGrad (TFOutput orig_input, TFOutput orig_output, TF /// Gradients w.r.t. the input to max_pool. /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// - public TFOutput MaxPoolGrad (TFOutput orig_input, TFOutput orig_output, TFOutput grad, long[] ksize, long[] strides, string padding, string data_format = null, string operName = null) + public TFOutput MaxPoolGrad (TFOutput orig_input, TFOutput orig_output, TFOutput grad, long[] ksize, long[] strides, string padding, long[] explicit_paddings = null, string data_format = null, string operName = null) { var desc = new TFOperationDesc (this, "MaxPoolGrad", MakeName ("MaxPoolGrad", operName)); desc.AddInput (orig_input); @@ -26250,6 +28463,9 @@ public TFOutput MaxPoolGrad (TFOutput orig_input, TFOutput orig_output, TFOutput desc.SetAttr ("ksize", ksize); desc.SetAttr ("strides", strides); desc.SetAttr ("padding", padding); + if (explicit_paddings != null) + desc.SetAttr ("explicit_paddings", explicit_paddings); + if (data_format != null) desc.SetAttr ("data_format", data_format); @@ -27084,6 +29300,72 @@ public TFOutput MirrorPadGrad (TFOutput input, TFOutput paddings, string mode, s return output; } + /// + /// Wraps an arbitrary MLIR computation expressed as a module with a main() function. + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'MlirPassthroughOp'. + /// + /// + /// + /// + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// This operation does not have an associated kernel and is not intended to be + /// executed in a regular TensorFlow session. Instead it is intended to be used for + /// testing or for special case where a user intends to pass custom MLIR computation + /// through a TensorFlow graph with the intent of having custom tooling processing + /// it downstream (when targeting a different environment, like TensorFlow lite for + /// example). + /// The MLIR module is expected to have a main() function that will be used as an + /// entry point. The inputs to the operations will be passed as argument to the + /// main() function and the returned values of the main function mapped to the + /// outputs. + /// Example usage: + /// + /// + /// import tensorflow as tf + /// from tensorflow.compiler.mlir.tensorflow.gen_mlir_passthrough_op import mlir_passthrough_op + /// + /// mlir_module = '''python + /// func @main(%arg0 : tensor&lt;10xf32&gt;, %arg1 : tensor&lt;10xf32&gt;) -&gt; tensor&lt;10x10xf32&gt; { + /// %add = "magic.op"(%arg0, %arg1) : (tensor&lt;10xf32&gt;, tensor&lt;10xf32&gt;) -&gt; tensor&lt;10x10xf32&gt; + /// return %ret : tensor&lt;10x10xf32&gt; + /// } + /// ''' + /// + /// @tf.function + /// def foo(x, y): + /// return mlir_passthrough_op([x, y], mlir_module, Toutputs=[tf.float32]) + /// + /// graph_def = foo.get_concrete_function(tf.TensorSpec([10], tf.float32), tf.TensorSpec([10], tf.float32)).graph.as_graph_def() + /// + /// + public TFOutput[] MlirPassthroughOp (TFOutput[] inputs, string mlir_module, TFDataType[] Toutputs, string operName = null) + { + var desc = new TFOperationDesc (this, "MlirPassthroughOp", MakeName ("MlirPassthroughOp", operName)); + desc.AddInputs (inputs); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("mlir_module", mlir_module); + desc.SetAttrType ("Toutputs", Toutputs); + var op = desc.FinishOperation (); + int _idx = 0; + int _n = 0; + _n = op.OutputListLength ("outputs"); + var outputs = new TFOutput [_n]; + for (int i = 0; i < _n; i++) + outputs [i] = new TFOutput (op, _idx++); + + return outputs; + } + /// /// Returns element-wise remainder of division. This emulates C semantics in that /// @@ -27133,6 +29415,9 @@ public TFOutput Mod (TFOutput x, TFOutput y, string operName = null) /// /// Optional argument /// + /// + /// Optional argument + /// /// /// /// @@ -27143,7 +29428,7 @@ public TFOutput Mod (TFOutput x, TFOutput y, string operName = null) /// /// Identity transformation that models performance. /// - public TFOutput ModelDataset (TFOutput input_dataset, TFDataType[] output_types, TFShape[] output_shapes, long? algorithm = null, long? cpu_budget = null, string operName = null) + public TFOutput ModelDataset (TFOutput input_dataset, TFDataType[] output_types, TFShape[] output_shapes, long? algorithm = null, long? cpu_budget = null, long? ram_budget = null, string operName = null) { var desc = new TFOperationDesc (this, "ModelDataset", MakeName ("ModelDataset", operName)); desc.AddInput (input_dataset); @@ -27158,6 +29443,9 @@ public TFOutput ModelDataset (TFOutput input_dataset, TFDataType[] output_types, if (cpu_budget.HasValue) desc.SetAttr ("cpu_budget", cpu_budget.Value); + if (ram_budget.HasValue) + desc.SetAttr ("ram_budget", ram_budget.Value); + var op = desc.FinishOperation (); int _idx = 0; var handle = new TFOutput (op, _idx++); @@ -29065,6 +31353,58 @@ public TFOutput OptimizeDataset (TFOutput input_dataset, TFOutput optimizations, return handle; } + /// + /// Creates a dataset by applying related optimizations to input_dataset. + /// + /// + /// A variant tensor representing the input dataset. + /// + /// + /// A tf.string vector tf.Tensor identifying user enabled optimizations. + /// + /// + /// A tf.string vector tf.Tensor identifying user disabled optimizations. + /// + /// + /// A tf.string vector tf.Tensor identifying optimizations by default. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'OptimizeDatasetV2'. + /// + /// + /// Optional argument + /// + /// + /// + /// + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Creates a dataset by applying related optimizations to input_dataset. + /// + public TFOutput OptimizeDatasetV2 (TFOutput input_dataset, TFOutput optimizations_enabled, TFOutput optimizations_disabled, TFOutput optimizations_default, TFDataType[] output_types, TFShape[] output_shapes, string[] optimization_configs = null, string operName = null) + { + var desc = new TFOperationDesc (this, "OptimizeDatasetV2", MakeName ("OptimizeDatasetV2", operName)); + desc.AddInput (input_dataset); + desc.AddInput (optimizations_enabled); + desc.AddInput (optimizations_disabled); + desc.AddInput (optimizations_default); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("output_types", output_types); + desc.SetAttrShape ("output_shapes", output_shapes); + if (optimization_configs != null) + desc.SetAttr ("optimization_configs", optimization_configs); + + var op = desc.FinishOperation (); + int _idx = 0; + var handle = new TFOutput (op, _idx++); + return handle; + } + /// /// Constructs an Optional variant from a tuple of tensors. /// @@ -29169,6 +31509,41 @@ public TFOutput OptionalNone (string operName = null) return optional; } + /// + /// Creates a dataset by attaching tf.data.Options to input_dataset. + /// + /// + /// A variant tensor representing the input dataset. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'OptionsDataset'. + /// + /// + /// A tf.string scalar tf.Tensor of serialized tf.data.Options protocol buffer. + /// + /// + /// + /// + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + public TFOutput OptionsDataset (TFOutput input_dataset, string serialized_options, TFDataType[] output_types, TFShape[] output_shapes, string operName = null) + { + var desc = new TFOperationDesc (this, "OptionsDataset", MakeName ("OptionsDataset", operName)); + desc.AddInput (input_dataset); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("serialized_options", serialized_options); + desc.SetAttrType ("output_types", output_types); + desc.SetAttrShape ("output_shapes", output_shapes); + var op = desc.FinishOperation (); + int _idx = 0; + var handle = new TFOutput (op, _idx++); + return handle; + } + /// /// Op removes all elements in the underlying container. /// @@ -29658,6 +32033,92 @@ public TFOutput[] OutfeedDequeueTuple (TFDataType[] dtypes, TFShape[] shapes, lo return outputs; } + /// + /// Retrieve multiple values from the computation outfeed. Device ordinal is a + /// tensor allowing dynamic outfeed. + /// + /// + /// An int scalar tensor, representing the TPU device to use. This should be -1 when + /// the Op is running on a TPU device, and &gt;= 0 when the Op is running on the CPU + /// device. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'OutfeedDequeueTupleV2'. + /// + /// + /// The element types of each element in outputs. + /// + /// + /// The shapes of each tensor in outputs. + /// + /// + /// A list of tensors that will be read from the outfeed. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// This operation will block indefinitely until data is available. Output i + /// corresponds to XLA tuple element i. + /// + public TFOutput[] OutfeedDequeueTupleV2 (TFOutput device_ordinal, TFDataType[] dtypes, TFShape[] shapes, string operName = null) + { + var desc = new TFOperationDesc (this, "OutfeedDequeueTupleV2", MakeName ("OutfeedDequeueTupleV2", operName)); + desc.AddInput (device_ordinal); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("dtypes", dtypes); + desc.SetAttrShape ("shapes", shapes); + var op = desc.FinishOperation (); + int _idx = 0; + int _n = 0; + _n = op.OutputListLength ("outputs"); + var outputs = new TFOutput [_n]; + for (int i = 0; i < _n; i++) + outputs [i] = new TFOutput (op, _idx++); + + return outputs; + } + + /// + /// Retrieves a single tensor from the computation outfeed. Device ordinal is a + /// tensor allowing dynamic outfeed. + /// + /// + /// An int scalar tensor, representing the TPU device to use. This should be -1 when + /// the Op is running on a TPU device, and &gt;= 0 when the Op is running on the CPU + /// device. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'OutfeedDequeueV2'. + /// + /// + /// The type of elements in the tensor. + /// + /// + /// The shape of the tensor. + /// + /// + /// A tensor that will be read from the device outfeed. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// This operation will block indefinitely until data is available. + /// + public TFOutput OutfeedDequeueV2 (TFOutput device_ordinal, TFDataType dtype, TFShape shape, string operName = null) + { + var desc = new TFOperationDesc (this, "OutfeedDequeueV2", MakeName ("OutfeedDequeueV2", operName)); + desc.AddInput (device_ordinal); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("dtype", dtype); + desc.SetAttrShape ("shape", shape); + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + /// /// Enqueue a Tensor on the computation outfeed. /// @@ -30432,6 +32893,15 @@ public TFOutput ParameterizedTruncatedNormal (TFOutput shape, TFOutput means, TF /// /// Optional argument /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// /// /// A list of string keys in the examples features. /// The results for these keys will be returned as SparseTensor objects. @@ -30465,7 +32935,7 @@ public TFOutput ParameterizedTruncatedNormal (TFOutput shape, TFOutput means, TF /// /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// - public TFOutput ParseExampleDataset (TFOutput input_dataset, TFOutput num_parallel_calls, TFOutput[] dense_defaults, string[] sparse_keys, string[] dense_keys, TFDataType[] sparse_types, TFShape[] dense_shapes, TFDataType[] output_types, TFShape[] output_shapes, bool? sloppy = null, string operName = null) + public TFOutput ParseExampleDataset (TFOutput input_dataset, TFOutput num_parallel_calls, TFOutput[] dense_defaults, string[] sparse_keys, string[] dense_keys, TFDataType[] sparse_types, TFShape[] dense_shapes, TFDataType[] output_types, TFShape[] output_shapes, bool? sloppy = null, string[] ragged_keys = null, TFDataType[] ragged_value_types = null, TFDataType[] ragged_split_types = null, string operName = null) { var desc = new TFOperationDesc (this, "ParseExampleDataset", MakeName ("ParseExampleDataset", operName)); desc.AddInput (input_dataset); @@ -30483,12 +32953,259 @@ public TFOutput ParseExampleDataset (TFOutput input_dataset, TFOutput num_parall if (sloppy.HasValue) desc.SetAttr ("sloppy", sloppy.Value); + if (ragged_keys != null) + desc.SetAttr ("ragged_keys", ragged_keys); + + if (ragged_value_types != null) + desc.SetAttrType ("ragged_value_types", ragged_value_types); + + if (ragged_split_types != null) + desc.SetAttrType ("ragged_split_types", ragged_split_types); + + var op = desc.FinishOperation (); + int _idx = 0; + var handle = new TFOutput (op, _idx++); + return handle; + } + + /// + /// Transforms input_dataset containing Example protos as vectors of DT_STRING into a dataset of Tensor or SparseTensor objects representing the parsed features. + /// + /// + /// + /// + /// + /// + /// A dict mapping string keys to Tensors. + /// The keys of the dict must match the dense_keys of the feature. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ParseExampleDatasetV2'. + /// + /// + /// Optional argument + /// A string indicating the op-level determinism to use. Deterministic controls + /// whether the dataset is allowed to return elements out of order if the next + /// element to be returned isn't available, but a later element is. Options are + /// "true", "false", and "default". "default" indicates that determinism should be + /// decided by the experimental_deterministic parameter of tf.data.Options. + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// A list of string keys in the examples features. + /// The results for these keys will be returned as SparseTensor objects. + /// + /// + /// A list of Ndense string Tensors (scalars). + /// The keys expected in the Examples features associated with dense values. + /// + /// + /// A list of DTypes of the same length as sparse_keys. + /// Only tf.float32 (FloatList), tf.int64 (Int64List), + /// and tf.string (BytesList) are supported. + /// + /// + /// List of tuples with the same length as dense_keys. + /// The shape of the data for each dense feature referenced by dense_keys. + /// Required for any input tensors identified by dense_keys. Must be + /// either fully defined, or may contain an unknown first dimension. + /// An unknown first dimension means the feature is treated as having + /// a variable number of blocks, and the output shape along this dimension + /// is considered unknown at graph build time. Padding is applied for + /// minibatch elements smaller than the maximum number of blocks for the + /// given feature along this dimension. + /// + /// + /// The type list for the return values. + /// + /// + /// The list of shapes being produced. + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + public TFOutput ParseExampleDatasetV2 (TFOutput input_dataset, TFOutput num_parallel_calls, TFOutput[] dense_defaults, string[] sparse_keys, string[] dense_keys, TFDataType[] sparse_types, TFShape[] dense_shapes, TFDataType[] output_types, TFShape[] output_shapes, string deterministic = null, string[] ragged_keys = null, TFDataType[] ragged_value_types = null, TFDataType[] ragged_split_types = null, string operName = null) + { + var desc = new TFOperationDesc (this, "ParseExampleDatasetV2", MakeName ("ParseExampleDatasetV2", operName)); + desc.AddInput (input_dataset); + desc.AddInput (num_parallel_calls); + desc.AddInputs (dense_defaults); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("sparse_keys", sparse_keys); + desc.SetAttr ("dense_keys", dense_keys); + desc.SetAttrType ("sparse_types", sparse_types); + desc.SetAttrShape ("dense_shapes", dense_shapes); + desc.SetAttrType ("output_types", output_types); + desc.SetAttrShape ("output_shapes", output_shapes); + if (deterministic != null) + desc.SetAttr ("deterministic", deterministic); + + if (ragged_keys != null) + desc.SetAttr ("ragged_keys", ragged_keys); + + if (ragged_value_types != null) + desc.SetAttrType ("ragged_value_types", ragged_value_types); + + if (ragged_split_types != null) + desc.SetAttrType ("ragged_split_types", ragged_split_types); + var op = desc.FinishOperation (); int _idx = 0; var handle = new TFOutput (op, _idx++); return handle; } + /// + /// Transforms a vector of tf.Example protos (as strings) into typed tensors. + /// + /// + /// A scalar or vector containing binary serialized Example protos. + /// + /// + /// A tensor containing the names of the serialized protos. + /// Corresponds 1:1 with the serialized tensor. + /// May contain, for example, table key (descriptive) names for the + /// corresponding serialized protos. These are purely useful for debugging + /// purposes, and the presence of values here has no effect on the output. + /// May also be an empty vector if no names are available. + /// If non-empty, this tensor must have the same shape as "serialized". + /// + /// + /// Vector of strings. + /// The keys expected in the Examples' features associated with sparse values. + /// + /// + /// Vector of strings. + /// The keys expected in the Examples' features associated with dense values. + /// + /// + /// Vector of strings. + /// The keys expected in the Examples' features associated with ragged values. + /// + /// + /// A list of Tensors (some may be empty). Corresponds 1:1 with dense_keys. + /// dense_defaults[j] provides default values + /// when the example's feature_map lacks dense_key[j]. If an empty Tensor is + /// provided for dense_defaults[j], then the Feature dense_keys[j] is required. + /// The input type is inferred from dense_defaults[j], even when it's empty. + /// If dense_defaults[j] is not empty, and dense_shapes[j] is fully defined, + /// then the shape of dense_defaults[j] must match that of dense_shapes[j]. + /// If dense_shapes[j] has an undefined major dimension (variable strides dense + /// feature), dense_defaults[j] must contain a single element: + /// the padding element. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ParseExampleV2'. + /// + /// + /// The number of sparse keys. + /// + /// + /// A list of num_sparse types; the data types of data in each Feature + /// given in sparse_keys. + /// Currently the ParseExample supports DT_FLOAT (FloatList), + /// DT_INT64 (Int64List), and DT_STRING (BytesList). + /// + /// + /// A list of num_ragged types; the data types of data in each Feature + /// given in ragged_keys (where num_ragged = sparse_keys.size()). + /// Currently the ParseExample supports DT_FLOAT (FloatList), + /// DT_INT64 (Int64List), and DT_STRING (BytesList). + /// + /// + /// A list of num_ragged types; the data types of row_splits in each Feature + /// given in ragged_keys (where num_ragged = sparse_keys.size()). + /// May be DT_INT32 or DT_INT64. + /// + /// + /// A list of num_dense shapes; the shapes of data in each Feature + /// given in dense_keys (where num_dense = dense_keys.size()). + /// The number of elements in the Feature corresponding to dense_key[j] + /// must always equal dense_shapes[j].NumEntries(). + /// If dense_shapes[j] == (D0, D1, ..., DN) then the shape of output + /// Tensor dense_values[j] will be (|serialized|, D0, D1, ..., DN): + /// The dense outputs are just the inputs row-stacked by batch. + /// This works for dense_shapes[j] = (-1, D1, ..., DN). In this case + /// the shape of the output Tensor dense_values[j] will be + /// (|serialized|, M, D1, .., DN), where M is the maximum number of blocks + /// of elements of length D1 * .... * DN, across all minibatch entries + /// in the input. Any minibatch entry with less than M blocks of elements of + /// length D1 * ... * DN will be padded with the corresponding default_value + /// scalar element along the second dimension. + /// + /// + /// Returns a tuple with multiple values, as follows: + /// sparse_indices: + /// sparse_values: + /// sparse_shapes: + /// dense_values: + /// ragged_values: + /// ragged_row_splits: + /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. + /// + public (TFOutput[] sparse_indices, TFOutput[] sparse_values, TFOutput[] sparse_shapes, TFOutput[] dense_values, TFOutput[] ragged_values, TFOutput[] ragged_row_splits) ParseExampleV2 (TFOutput serialized, TFOutput names, TFOutput sparse_keys, TFOutput dense_keys, TFOutput ragged_keys, TFOutput[] dense_defaults, long num_sparse, TFDataType[] sparse_types, TFDataType[] ragged_value_types, TFDataType[] ragged_split_types, TFShape[] dense_shapes, string operName = null) + { + var desc = new TFOperationDesc (this, "ParseExampleV2", MakeName ("ParseExampleV2", operName)); + desc.AddInput (serialized); + desc.AddInput (names); + desc.AddInput (sparse_keys); + desc.AddInput (dense_keys); + desc.AddInput (ragged_keys); + desc.AddInputs (dense_defaults); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("num_sparse", num_sparse); + desc.SetAttrType ("sparse_types", sparse_types); + desc.SetAttrType ("ragged_value_types", ragged_value_types); + desc.SetAttrType ("ragged_split_types", ragged_split_types); + desc.SetAttrShape ("dense_shapes", dense_shapes); + var op = desc.FinishOperation (); + int _idx = 0; + int _n = 0; + _n = op.OutputListLength ("sparse_indices"); + var sparse_indices = new TFOutput [_n]; + for (int i = 0; i < _n; i++) + sparse_indices [i] = new TFOutput (op, _idx++); + + _n = op.OutputListLength ("sparse_values"); + var sparse_values = new TFOutput [_n]; + for (int i = 0; i < _n; i++) + sparse_values [i] = new TFOutput (op, _idx++); + + _n = op.OutputListLength ("sparse_shapes"); + var sparse_shapes = new TFOutput [_n]; + for (int i = 0; i < _n; i++) + sparse_shapes [i] = new TFOutput (op, _idx++); + + _n = op.OutputListLength ("dense_values"); + var dense_values = new TFOutput [_n]; + for (int i = 0; i < _n; i++) + dense_values [i] = new TFOutput (op, _idx++); + + _n = op.OutputListLength ("ragged_values"); + var ragged_values = new TFOutput [_n]; + for (int i = 0; i < _n; i++) + ragged_values [i] = new TFOutput (op, _idx++); + + _n = op.OutputListLength ("ragged_row_splits"); + var ragged_row_splits = new TFOutput [_n]; + for (int i = 0; i < _n; i++) + ragged_row_splits [i] = new TFOutput (op, _idx++); + + return (sparse_indices, sparse_values, sparse_shapes, dense_values, ragged_values, ragged_row_splits); + } + /// /// Transforms a vector of brain.SequenceExample protos (as strings) into typed tensors. /// @@ -30691,6 +33408,264 @@ public TFOutput ParseExampleDataset (TFOutput input_dataset, TFOutput num_parall return (context_sparse_indices, context_sparse_values, context_sparse_shapes, context_dense_values, feature_list_sparse_indices, feature_list_sparse_values, feature_list_sparse_shapes, feature_list_dense_values, feature_list_dense_lengths); } + /// + /// Transforms a vector of tf.io.SequenceExample protos (as strings) into + /// typed tensors. + /// + /// + /// A scalar or vector containing binary serialized SequenceExample protos. + /// + /// + /// A scalar or vector containing the names of the serialized protos. + /// May contain, for example, table key (descriptive) name for the + /// corresponding serialized proto. This is purely useful for debugging + /// purposes, and the presence of values here has no effect on the output. + /// May also be an empty vector if no name is available. + /// + /// + /// The keys expected in the Examples' features associated with context_sparse + /// values. + /// + /// + /// The keys expected in the SequenceExamples' context features associated with + /// dense values. + /// + /// + /// The keys expected in the Examples' features associated with context_ragged + /// values. + /// + /// + /// The keys expected in the FeatureLists associated with sparse values. + /// + /// + /// The keys expected in the SequenceExamples' feature_lists associated + /// with lists of dense values. + /// + /// + /// The keys expected in the FeatureLists associated with ragged values. + /// + /// + /// A vector corresponding 1:1 with feature_list_dense_keys, indicating which + /// features may be missing from the SequenceExamples. If the associated + /// FeatureList is missing, it is treated as empty. + /// + /// + /// A list of Ncontext_dense Tensors (some may be empty). + /// context_dense_defaults[j] provides default values + /// when the SequenceExample's context map lacks context_dense_key[j]. + /// If an empty Tensor is provided for context_dense_defaults[j], + /// then the Feature context_dense_keys[j] is required. + /// The input type is inferred from context_dense_defaults[j], even when it's + /// empty. If context_dense_defaults[j] is not empty, its shape must match + /// context_dense_shapes[j]. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ParseSequenceExampleV2'. + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// A list of Ncontext_sparse types; the data types of data in + /// each context Feature given in context_sparse_keys. + /// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), + /// DT_INT64 (Int64List), and DT_STRING (BytesList). + /// + /// + /// Optional argument + /// RaggedTensor.value dtypes for the ragged context features. + /// + /// + /// Optional argument + /// RaggedTensor.row_split dtypes for the ragged context features. + /// + /// + /// Optional argument + /// A list of Ncontext_dense shapes; the shapes of data in + /// each context Feature given in context_dense_keys. + /// The number of elements in the Feature corresponding to context_dense_key[j] + /// must always equal context_dense_shapes[j].NumEntries(). + /// The shape of context_dense_values[j] will match context_dense_shapes[j]. + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// A list of Nfeature_list_sparse types; the data types + /// of data in each FeatureList given in feature_list_sparse_keys. + /// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), + /// DT_INT64 (Int64List), and DT_STRING (BytesList). + /// + /// + /// Optional argument + /// RaggedTensor.value dtypes for the ragged FeatureList features. + /// + /// + /// Optional argument + /// RaggedTensor.row_split dtypes for the ragged FeatureList features. + /// + /// + /// Optional argument + /// A list of Nfeature_list_dense shapes; the shapes of + /// data in each FeatureList given in feature_list_dense_keys. + /// The shape of each Feature in the FeatureList corresponding to + /// feature_list_dense_key[j] must always equal + /// feature_list_dense_shapes[j].NumEntries(). + /// + /// + /// Returns a tuple with multiple values, as follows: + /// context_sparse_indices: + /// context_sparse_values: + /// context_sparse_shapes: + /// context_dense_values: + /// context_ragged_values: + /// context_ragged_row_splits: + /// feature_list_sparse_indices: + /// feature_list_sparse_values: + /// feature_list_sparse_shapes: + /// feature_list_dense_values: + /// feature_list_dense_lengths: + /// feature_list_ragged_values: + /// feature_list_ragged_outer_splits: + /// feature_list_ragged_inner_splits: + /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. + /// + public (TFOutput[] context_sparse_indices, TFOutput[] context_sparse_values, TFOutput[] context_sparse_shapes, TFOutput[] context_dense_values, TFOutput[] context_ragged_values, TFOutput[] context_ragged_row_splits, TFOutput[] feature_list_sparse_indices, TFOutput[] feature_list_sparse_values, TFOutput[] feature_list_sparse_shapes, TFOutput[] feature_list_dense_values, TFOutput[] feature_list_dense_lengths, TFOutput[] feature_list_ragged_values, TFOutput[] feature_list_ragged_outer_splits, TFOutput[] feature_list_ragged_inner_splits) ParseSequenceExampleV2 (TFOutput serialized, TFOutput debug_name, TFOutput context_sparse_keys, TFOutput context_dense_keys, TFOutput context_ragged_keys, TFOutput feature_list_sparse_keys, TFOutput feature_list_dense_keys, TFOutput feature_list_ragged_keys, TFOutput feature_list_dense_missing_assumed_empty, TFOutput[] context_dense_defaults, long? Ncontext_sparse = null, TFDataType[] context_sparse_types = null, TFDataType[] context_ragged_value_types = null, TFDataType[] context_ragged_split_types = null, TFShape[] context_dense_shapes = null, long? Nfeature_list_sparse = null, long? Nfeature_list_dense = null, TFDataType[] feature_list_dense_types = null, TFDataType[] feature_list_sparse_types = null, TFDataType[] feature_list_ragged_value_types = null, TFDataType[] feature_list_ragged_split_types = null, TFShape[] feature_list_dense_shapes = null, string operName = null) + { + var desc = new TFOperationDesc (this, "ParseSequenceExampleV2", MakeName ("ParseSequenceExampleV2", operName)); + desc.AddInput (serialized); + desc.AddInput (debug_name); + desc.AddInput (context_sparse_keys); + desc.AddInput (context_dense_keys); + desc.AddInput (context_ragged_keys); + desc.AddInput (feature_list_sparse_keys); + desc.AddInput (feature_list_dense_keys); + desc.AddInput (feature_list_ragged_keys); + desc.AddInput (feature_list_dense_missing_assumed_empty); + desc.AddInputs (context_dense_defaults); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (Ncontext_sparse.HasValue) + desc.SetAttr ("Ncontext_sparse", Ncontext_sparse.Value); + + if (context_sparse_types != null) + desc.SetAttrType ("context_sparse_types", context_sparse_types); + + if (context_ragged_value_types != null) + desc.SetAttrType ("context_ragged_value_types", context_ragged_value_types); + + if (context_ragged_split_types != null) + desc.SetAttrType ("context_ragged_split_types", context_ragged_split_types); + + if (context_dense_shapes != null) + desc.SetAttrShape ("context_dense_shapes", context_dense_shapes); + + if (Nfeature_list_sparse.HasValue) + desc.SetAttr ("Nfeature_list_sparse", Nfeature_list_sparse.Value); + + if (Nfeature_list_dense.HasValue) + desc.SetAttr ("Nfeature_list_dense", Nfeature_list_dense.Value); + + if (feature_list_dense_types != null) + desc.SetAttrType ("feature_list_dense_types", feature_list_dense_types); + + if (feature_list_sparse_types != null) + desc.SetAttrType ("feature_list_sparse_types", feature_list_sparse_types); + + if (feature_list_ragged_value_types != null) + desc.SetAttrType ("feature_list_ragged_value_types", feature_list_ragged_value_types); + + if (feature_list_ragged_split_types != null) + desc.SetAttrType ("feature_list_ragged_split_types", feature_list_ragged_split_types); + + if (feature_list_dense_shapes != null) + desc.SetAttrShape ("feature_list_dense_shapes", feature_list_dense_shapes); + + var op = desc.FinishOperation (); + int _idx = 0; + int _n = 0; + _n = op.OutputListLength ("context_sparse_indices"); + var context_sparse_indices = new TFOutput [_n]; + for (int i = 0; i < _n; i++) + context_sparse_indices [i] = new TFOutput (op, _idx++); + + _n = op.OutputListLength ("context_sparse_values"); + var context_sparse_values = new TFOutput [_n]; + for (int i = 0; i < _n; i++) + context_sparse_values [i] = new TFOutput (op, _idx++); + + _n = op.OutputListLength ("context_sparse_shapes"); + var context_sparse_shapes = new TFOutput [_n]; + for (int i = 0; i < _n; i++) + context_sparse_shapes [i] = new TFOutput (op, _idx++); + + _n = op.OutputListLength ("context_dense_values"); + var context_dense_values = new TFOutput [_n]; + for (int i = 0; i < _n; i++) + context_dense_values [i] = new TFOutput (op, _idx++); + + _n = op.OutputListLength ("context_ragged_values"); + var context_ragged_values = new TFOutput [_n]; + for (int i = 0; i < _n; i++) + context_ragged_values [i] = new TFOutput (op, _idx++); + + _n = op.OutputListLength ("context_ragged_row_splits"); + var context_ragged_row_splits = new TFOutput [_n]; + for (int i = 0; i < _n; i++) + context_ragged_row_splits [i] = new TFOutput (op, _idx++); + + _n = op.OutputListLength ("feature_list_sparse_indices"); + var feature_list_sparse_indices = new TFOutput [_n]; + for (int i = 0; i < _n; i++) + feature_list_sparse_indices [i] = new TFOutput (op, _idx++); + + _n = op.OutputListLength ("feature_list_sparse_values"); + var feature_list_sparse_values = new TFOutput [_n]; + for (int i = 0; i < _n; i++) + feature_list_sparse_values [i] = new TFOutput (op, _idx++); + + _n = op.OutputListLength ("feature_list_sparse_shapes"); + var feature_list_sparse_shapes = new TFOutput [_n]; + for (int i = 0; i < _n; i++) + feature_list_sparse_shapes [i] = new TFOutput (op, _idx++); + + _n = op.OutputListLength ("feature_list_dense_values"); + var feature_list_dense_values = new TFOutput [_n]; + for (int i = 0; i < _n; i++) + feature_list_dense_values [i] = new TFOutput (op, _idx++); + + _n = op.OutputListLength ("feature_list_dense_lengths"); + var feature_list_dense_lengths = new TFOutput [_n]; + for (int i = 0; i < _n; i++) + feature_list_dense_lengths [i] = new TFOutput (op, _idx++); + + _n = op.OutputListLength ("feature_list_ragged_values"); + var feature_list_ragged_values = new TFOutput [_n]; + for (int i = 0; i < _n; i++) + feature_list_ragged_values [i] = new TFOutput (op, _idx++); + + _n = op.OutputListLength ("feature_list_ragged_outer_splits"); + var feature_list_ragged_outer_splits = new TFOutput [_n]; + for (int i = 0; i < _n; i++) + feature_list_ragged_outer_splits [i] = new TFOutput (op, _idx++); + + _n = op.OutputListLength ("feature_list_ragged_inner_splits"); + var feature_list_ragged_inner_splits = new TFOutput [_n]; + for (int i = 0; i < _n; i++) + feature_list_ragged_inner_splits [i] = new TFOutput (op, _idx++); + + return (context_sparse_indices, context_sparse_values, context_sparse_shapes, context_dense_values, context_ragged_values, context_ragged_row_splits, feature_list_sparse_indices, feature_list_sparse_values, feature_list_sparse_shapes, feature_list_dense_values, feature_list_dense_lengths, feature_list_ragged_values, feature_list_ragged_outer_splits, feature_list_ragged_inner_splits); + } + /// /// Transforms a tf.Example proto (as a string) into typed tensors. /// @@ -31219,6 +34194,9 @@ public TFOutput Pow (TFOutput x, TFOutput y, string operName = null) /// /// Optional argument /// + /// + /// Optional argument + /// /// /// /// @@ -31226,7 +34204,7 @@ public TFOutput Pow (TFOutput x, TFOutput y, string operName = null) /// /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// - public TFOutput PrefetchDataset (TFOutput input_dataset, TFOutput buffer_size, TFDataType[] output_types, TFShape[] output_shapes, long? slack_period = null, bool? legacy_autotune = null, string operName = null) + public TFOutput PrefetchDataset (TFOutput input_dataset, TFOutput buffer_size, TFDataType[] output_types, TFShape[] output_shapes, long? slack_period = null, bool? legacy_autotune = null, long? buffer_size_min = null, string operName = null) { var desc = new TFOperationDesc (this, "PrefetchDataset", MakeName ("PrefetchDataset", operName)); desc.AddInput (input_dataset); @@ -31242,6 +34220,9 @@ public TFOutput PrefetchDataset (TFOutput input_dataset, TFOutput buffer_size, T if (legacy_autotune.HasValue) desc.SetAttr ("legacy_autotune", legacy_autotune.Value); + if (buffer_size_min.HasValue) + desc.SetAttr ("buffer_size_min", buffer_size_min.Value); + var op = desc.FinishOperation (); int _idx = 0; var handle = new TFOutput (op, _idx++); @@ -31396,7 +34377,7 @@ public TFOutput PreventGradient (TFOutput input, string message = null, string o /// Only print this many entries of each tensor. /// /// - /// = The unmodified input tensor + /// The unmodified input tensor /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// /// @@ -31783,6 +34764,10 @@ public TFOutput[] PyFuncStateless (TFOutput[] input, string token, TFDataType[] /// Computes the QR decomposition of each inner matrix in tensor such that /// tensor[..., :, :] = q[..., :, :] * r[..., :,:]) /// + /// Currently, the gradient for the QR decomposition is well-defined only when + /// the first P columns of the inner matrix are linearly independent, where + /// P is the minimum of M and N, the 2 inner-most dimmensions of tensor. + /// /// /// # a is a tensor. /// # q is a tensor of orthonormal matrices. @@ -31862,6 +34847,150 @@ public TFOutput QuantizeAndDequantize (TFOutput input, bool? signed_input = null return output; } + /// + /// Quantizes then dequantizes a tensor. + /// + /// + /// Tensor to quantize and then dequantize. + /// + /// + /// If range_given == True, this specifies the minimum input value that needs to + /// be represented, otherwise it is determined from the min value of the input + /// tensor. + /// + /// + /// If range_given == True, this specifies the maximum input value that needs to + /// be represented, otherwise it is determined from the max value of the input + /// tensor. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'QuantizeAndDequantizeV2'. + /// + /// + /// Optional argument + /// Whether the quantization is signed or unsigned. (actually this parameter should + /// have been called &lt;b&gt;signed_output&lt;/b&gt;) + /// + /// + /// Optional argument + /// The bitwidth of the quantization. + /// + /// + /// Optional argument + /// Whether the range is given or should be determined from the input tensor. + /// + /// + /// Optional argument + /// The 'round_mode' attribute controls which rounding tie-breaking algorithm is + /// used when rounding float values to their quantized equivalents. The following + /// rounding modes are currently supported: + /// + /// * HALF_TO_EVEN: this is the default round_mode. + /// * HALF_UP: round towards positive. In this mode 7.5 rounds up to 8 and -7.5 + /// rounds up to -7. + /// + /// + /// + /// Optional argument + /// If True, then the absolute value of the quantized minimum value is the same as + /// the quantized maximum value, instead of 1 greater. + /// i.e. for 8 bit quantization, the minimum value is -127 instead of -128. + /// + /// + /// Optional argument + /// If specified, this axis is treated as a channel or slice axis, and a separate + /// quantization range is used for each channel or slice along this axis. + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// This op simulates the precision loss from the quantized forward pass by: + /// + /// 1. Quantizing the tensor to fixed point numbers, which should match the target + /// quantization method when it is used in inference. + /// 2. Dequantizing it back to floating point numbers for the following ops, most + /// likely matmul. + /// + /// There are different ways to quantize. This version uses only scaling, so 0.0 + /// maps to 0. + /// + /// From the specified 'num_bits' in the quantized output type, it determines + /// minimum and maximum representable quantized values. + /// + /// e.g. + /// + /// * [-128, 127] for signed, num_bits = 8, or + /// * [0, 255] for unsigned, num_bits = 8. + /// + /// If range_given == False, the initial input_min, input_max will be determined + /// automatically as the minimum and maximum values in the input tensor, otherwise + /// the specified values of input_min, input_max are used. + /// + /// Note: If the input_min, input_max are specified, they do not need to equal the + /// actual minimum and maximum values in the tensor. e.g. in some cases it may be + /// beneficial to specify these values such that the low probability extremes of the + /// input distribution are clipped. + /// + /// This op determines the maximum scale_factor that would map the initial + /// [input_min, input_max] range to a range that lies within the representable + /// quantized range. + /// + /// It determines the scale from one of input_min and input_max, then updates the + /// other one to maximize the representable range. + /// + /// e.g. + /// + /// * if the output is signed, num_bits = 8, [input_min, input_max] = [-10.0, + /// 5.0]: it would use a scale_factor of -128 / -10.0 = 12.8 In this case, it + /// would update input_max to be 127 / 12.8 = 9.921875 + /// * if the output is signed, num_bits = 8, [input_min, input_max] = [-10.0, + /// 10.0]: it would use a scale_factor of 127 / 10.0 = 12.7 In this case, it + /// would update input_min to be 128.0 / 12.7 = -10.07874 + /// * if the output is unsigned, input_min is forced to be 0, and only the + /// specified input_max is used. + /// + /// After determining the scale_factor and updating the input range, it applies the + /// following to each value in the 'input' tensor. + /// + /// output = round(clamp(value, input_min, input_max) * scale_factor) / scale_factor. + /// + /// The above round function rounds the value based on the given round_mode. + /// + /// + public TFOutput QuantizeAndDequantizeV2 (TFOutput input, TFOutput input_min, TFOutput input_max, bool? signed_input = null, long? num_bits = null, bool? range_given = null, string round_mode = null, bool? narrow_range = null, long? axis = null, string operName = null) + { + var desc = new TFOperationDesc (this, "QuantizeAndDequantizeV2", MakeName ("QuantizeAndDequantizeV2", operName)); + desc.AddInput (input); + desc.AddInput (input_min); + desc.AddInput (input_max); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (signed_input.HasValue) + desc.SetAttr ("signed_input", signed_input.Value); + + if (num_bits.HasValue) + desc.SetAttr ("num_bits", num_bits.Value); + + if (range_given.HasValue) + desc.SetAttr ("range_given", range_given.Value); + + if (round_mode != null) + desc.SetAttr ("round_mode", round_mode); + + if (narrow_range.HasValue) + desc.SetAttr ("narrow_range", narrow_range.Value); + + if (axis.HasValue) + desc.SetAttr ("axis", axis.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + /// /// Quantizes then dequantizes a tensor. /// @@ -31885,6 +35014,9 @@ public TFOutput QuantizeAndDequantize (TFOutput input, bool? signed_input = null /// /// Optional argument /// + /// + /// Optional argument + /// /// /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// @@ -31892,7 +35024,7 @@ public TFOutput QuantizeAndDequantize (TFOutput input, bool? signed_input = null /// This is almost identical to QuantizeAndDequantizeV2, except that num_bits is a /// tensor, so its value can change during training. /// - public TFOutput QuantizeAndDequantizeV3 (TFOutput input, TFOutput input_min, TFOutput input_max, TFOutput num_bits, bool? signed_input = null, bool? range_given = null, bool? narrow_range = null, string operName = null) + public TFOutput QuantizeAndDequantizeV3 (TFOutput input, TFOutput input_min, TFOutput input_max, TFOutput num_bits, bool? signed_input = null, bool? range_given = null, bool? narrow_range = null, long? axis = null, string operName = null) { var desc = new TFOperationDesc (this, "QuantizeAndDequantizeV3", MakeName ("QuantizeAndDequantizeV3", operName)); desc.AddInput (input); @@ -31911,12 +35043,158 @@ public TFOutput QuantizeAndDequantizeV3 (TFOutput input, TFOutput input_min, TFO if (narrow_range.HasValue) desc.SetAttr ("narrow_range", narrow_range.Value); + if (axis.HasValue) + desc.SetAttr ("axis", axis.Value); + var op = desc.FinishOperation (); int _idx = 0; var output = new TFOutput (op, _idx++); return output; } + /// + /// Quantizes then dequantizes a tensor. + /// + /// + /// Tensor to quantize and then dequantize. + /// + /// + /// If range_given == True, this specifies the minimum input value that needs to + /// be represented, otherwise it is determined from the min value of the input + /// tensor. + /// + /// + /// If range_given == True, this specifies the maximum input value that needs to + /// be represented, otherwise it is determined from the max value of the input + /// tensor. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'QuantizeAndDequantizeV4'. + /// + /// + /// Optional argument + /// Whether the quantization is signed or unsigned. (actually this parameter should + /// have been called &lt;b&gt;signed_output&lt;/b&gt;) + /// + /// + /// Optional argument + /// The bitwidth of the quantization. + /// + /// + /// Optional argument + /// Whether the range is given or should be determined from the input tensor. + /// + /// + /// Optional argument + /// The 'round_mode' attribute controls which rounding tie-breaking algorithm is + /// used when rounding float values to their quantized equivalents. The following + /// rounding modes are currently supported: + /// + /// * HALF_TO_EVEN: this is the default round_mode. + /// * HALF_UP: round towards positive. In this mode 7.5 rounds up to 8 and -7.5 + /// rounds up to -7. + /// + /// + /// + /// Optional argument + /// If True, then the absolute value of the quantized minimum value is the same as + /// the quantized maximum value, instead of 1 greater. + /// i.e. for 8 bit quantization, the minimum value is -127 instead of -128. + /// + /// + /// Optional argument + /// If specified, this axis is treated as a channel or slice axis, and a separate + /// quantization range is used for each channel or slice along this axis. + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// This is almost identical to QuantizeAndDequantizeV2, except that it returns a + /// gradient of 1 for inputs that are within the quantization range, or 0 otherwise. + /// + public TFOutput QuantizeAndDequantizeV4 (TFOutput input, TFOutput input_min, TFOutput input_max, bool? signed_input = null, long? num_bits = null, bool? range_given = null, string round_mode = null, bool? narrow_range = null, long? axis = null, string operName = null) + { + var desc = new TFOperationDesc (this, "QuantizeAndDequantizeV4", MakeName ("QuantizeAndDequantizeV4", operName)); + desc.AddInput (input); + desc.AddInput (input_min); + desc.AddInput (input_max); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (signed_input.HasValue) + desc.SetAttr ("signed_input", signed_input.Value); + + if (num_bits.HasValue) + desc.SetAttr ("num_bits", num_bits.Value); + + if (range_given.HasValue) + desc.SetAttr ("range_given", range_given.Value); + + if (round_mode != null) + desc.SetAttr ("round_mode", round_mode); + + if (narrow_range.HasValue) + desc.SetAttr ("narrow_range", narrow_range.Value); + + if (axis.HasValue) + desc.SetAttr ("axis", axis.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + + /// + /// Returns the gradient of QuantizeAndDequantizeV4. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'QuantizeAndDequantizeV4Grad'. + /// + /// + /// Optional argument + /// + /// + /// Returns a tuple with multiple values, as follows: + /// input_backprop: + /// input_min_backprop: + /// input_max_backprop: + /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. + /// + /// + /// Returns a gradient of 1 for inputs that are within the quantization range, + /// or 0 otherwise. + /// + public (TFOutput input_backprop, TFOutput input_min_backprop, TFOutput input_max_backprop) QuantizeAndDequantizeV4Grad (TFOutput gradients, TFOutput input, TFOutput input_min, TFOutput input_max, long? axis = null, string operName = null) + { + var desc = new TFOperationDesc (this, "QuantizeAndDequantizeV4Grad", MakeName ("QuantizeAndDequantizeV4Grad", operName)); + desc.AddInput (gradients); + desc.AddInput (input); + desc.AddInput (input_min); + desc.AddInput (input_max); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (axis.HasValue) + desc.SetAttr ("axis", axis.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var input_backprop = new TFOutput (op, _idx++); + var input_min_backprop = new TFOutput (op, _idx++); + var input_max_backprop = new TFOutput (op, _idx++); + return (input_backprop, input_min_backprop, input_max_backprop); + } + /// /// Returns x + y element-wise, working on quantized buffers. /// @@ -32578,6 +35856,9 @@ public TFOutput QuantizeAndDequantizeV3 (TFOutput input, TFOutput input_min, TFO /// Optional argument /// List of dilation values. /// + /// + /// Optional argument + /// /// /// List of stride values. /// @@ -32590,7 +35871,7 @@ public TFOutput QuantizeAndDequantizeV3 (TFOutput input, TFOutput input_min, TFO /// max_output: The float value that the maximum quantized output value represents. /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. /// - public (TFOutput output, TFOutput min_output, TFOutput max_output) QuantizedDepthwiseConv2DWithBiasAndRelu (TFOutput input, TFOutput filter, TFOutput bias, TFOutput min_input, TFOutput max_input, TFOutput min_filter, TFOutput max_filter, long[] strides, string padding, TFDataType? out_type = null, long[] dilations = null, string operName = null) + public (TFOutput output, TFOutput min_output, TFOutput max_output) QuantizedDepthwiseConv2DWithBiasAndRelu (TFOutput input, TFOutput filter, TFOutput bias, TFOutput min_input, TFOutput max_input, TFOutput min_filter, TFOutput max_filter, long[] strides, string padding, TFDataType? out_type = null, long[] dilations = null, long[] padding_list = null, string operName = null) { var desc = new TFOperationDesc (this, "QuantizedDepthwiseConv2DWithBiasAndRelu", MakeName ("QuantizedDepthwiseConv2DWithBiasAndRelu", operName)); desc.AddInput (input); @@ -32611,6 +35892,9 @@ public TFOutput QuantizeAndDequantizeV3 (TFOutput input, TFOutput input_min, TFO if (dilations != null) desc.SetAttr ("dilations", dilations); + if (padding_list != null) + desc.SetAttr ("padding_list", padding_list); + var op = desc.FinishOperation (); int _idx = 0; var output = new TFOutput (op, _idx++); @@ -32660,6 +35944,9 @@ public TFOutput QuantizeAndDequantizeV3 (TFOutput input, TFOutput input_min, TFO /// Optional argument /// List of dilation values. /// + /// + /// Optional argument + /// /// /// List of stride values. /// @@ -32672,7 +35959,7 @@ public TFOutput QuantizeAndDequantizeV3 (TFOutput input, TFOutput input_min, TFO /// max_output: The float value that the maximum quantized output value represents. /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. /// - public (TFOutput output, TFOutput min_output, TFOutput max_output) QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize (TFOutput input, TFOutput filter, TFOutput bias, TFOutput min_input, TFOutput max_input, TFOutput min_filter, TFOutput max_filter, TFOutput min_freezed_output, TFOutput max_freezed_output, long[] strides, string padding, TFDataType? out_type = null, long[] dilations = null, string operName = null) + public (TFOutput output, TFOutput min_output, TFOutput max_output) QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize (TFOutput input, TFOutput filter, TFOutput bias, TFOutput min_input, TFOutput max_input, TFOutput min_filter, TFOutput max_filter, TFOutput min_freezed_output, TFOutput max_freezed_output, long[] strides, string padding, TFDataType? out_type = null, long[] dilations = null, long[] padding_list = null, string operName = null) { var desc = new TFOperationDesc (this, "QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize", MakeName ("QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize", operName)); desc.AddInput (input); @@ -32695,6 +35982,9 @@ public TFOutput QuantizeAndDequantizeV3 (TFOutput input, TFOutput input_min, TFO if (dilations != null) desc.SetAttr ("dilations", dilations); + if (padding_list != null) + desc.SetAttr ("padding_list", padding_list); + var op = desc.FinishOperation (); int _idx = 0; var output = new TFOutput (op, _idx++); @@ -32920,7 +36210,7 @@ public TFOutput QuantizeAndDequantizeV3 (TFOutput input, TFOutput input_min, TFO /// dimension of a (after being transposed if transpose_a is non-zero) must /// match the outer dimension of b (after being transposed if transposed_b is /// non-zero). Then do broadcast add operation with bias values on the matrix - /// mulplication result. The bias size must match inner dimension of b. + /// multiplication result. The bias size must match inner dimension of b. /// public (TFOutput output, TFOutput min_out, TFOutput max_out) QuantizedMatMulWithBias (TFOutput a, TFOutput b, TFOutput bias, TFOutput min_a, TFOutput max_a, TFOutput min_b, TFOutput max_b, TFDataType? Toutput = null, bool? transpose_a = null, bool? transpose_b = null, string input_quant_mode = null, string operName = null) { @@ -33011,7 +36301,7 @@ public TFOutput QuantizeAndDequantizeV3 (TFOutput input, TFOutput input_min, TFO /// dimension of a (after being transposed if transpose_a is non-zero) must /// match the outer dimension of b (after being transposed if transposed_b is /// non-zero). Then do broadcast add operation with bias values on the matrix - /// mulplication result. The bias size must match inner dimension of b. Then do + /// multiplication result. The bias size must match inner dimension of b. Then do /// relu activation to get non-negative result. /// public (TFOutput output, TFOutput min_out, TFOutput max_out) QuantizedMatMulWithBiasAndRelu (TFOutput a, TFOutput b, TFOutput bias, TFOutput min_a, TFOutput max_a, TFOutput min_b, TFOutput max_b, TFDataType? Toutput = null, bool? transpose_a = null, bool? transpose_b = null, string input_quant_mode = null, string operName = null) @@ -33108,7 +36398,7 @@ public TFOutput QuantizeAndDequantizeV3 (TFOutput input, TFOutput input_min, TFO /// dimension of a (after being transposed if transpose_a is non-zero) must /// match the outer dimension of b (after being transposed if transposed_b is /// non-zero). Then do broadcast add operation with bias values on the matrix - /// mulplication result. The bias size must match inner dimension of b. Then do + /// multiplication result. The bias size must match inner dimension of b. Then do /// relu activation to get non-negative result. Then do requantize operation to get /// final uint8 result. /// @@ -33590,6 +36880,15 @@ public TFOutput QuantizeAndDequantizeV3 (TFOutput input, TFOutput input_min, TFO /// /// Optional argument /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// /// /// /// @@ -33731,7 +37030,7 @@ public TFOutput QuantizeAndDequantizeV3 (TFOutput input, TFOutput input_min, TFO /// set it to 0 for new uses. /// /// - public (TFOutput output, TFOutput output_min, TFOutput output_max) QuantizeV2 (TFOutput input, TFOutput min_range, TFOutput max_range, TFDataType T, string mode = null, string round_mode = null, string operName = null) + public (TFOutput output, TFOutput output_min, TFOutput output_max) QuantizeV2 (TFOutput input, TFOutput min_range, TFOutput max_range, TFDataType T, string mode = null, string round_mode = null, bool? narrow_range = null, long? axis = null, float? ensure_minimum_range = null, string operName = null) { var desc = new TFOperationDesc (this, "QuantizeV2", MakeName ("QuantizeV2", operName)); desc.AddInput (input); @@ -33747,6 +37046,15 @@ public TFOutput QuantizeAndDequantizeV3 (TFOutput input, TFOutput input_min, TFO if (round_mode != null) desc.SetAttr ("round_mode", round_mode); + if (narrow_range.HasValue) + desc.SetAttr ("narrow_range", narrow_range.Value); + + if (axis.HasValue) + desc.SetAttr ("axis", axis.Value); + + if (ensure_minimum_range.HasValue) + desc.SetAttr ("ensure_minimum_range", ensure_minimum_range.Value); + var op = desc.FinishOperation (); int _idx = 0; var output = new TFOutput (op, _idx++); @@ -34487,6 +37795,202 @@ public TFOutput QueueSizeV2 (TFOutput handle, string operName = null) return size; } + /// + /// Counts the number of occurrences of each value in an integer array. + /// + /// + /// 1D int64 Tensor. + /// + /// + /// 2D int Tensor. + /// + /// + /// non-negative int scalar Tensor. + /// + /// + /// is an int32, int64, float32, or float64 Tensor with the same + /// shape as input, 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 'RaggedBincount'. + /// + /// + /// Optional argument + /// bool; Whether the kernel should count the appearance or number of occurrences. + /// + /// + /// 1D Tensor with length equal to size or 2D Tensor with [batch_size, size]. + /// The counts or summed weights for each value in the range [0, size). + /// The TFOperation can be fetched from the resulting TFOutput, by fethching 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 TFOutput RaggedBincount (TFOutput splits, TFOutput values, TFOutput size, TFOutput weights, bool? binary_output = null, string operName = null) + { + var desc = new TFOperationDesc (this, "RaggedBincount", MakeName ("RaggedBincount", operName)); + desc.AddInput (splits); + desc.AddInput (values); + desc.AddInput (size); + desc.AddInput (weights); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (binary_output.HasValue) + desc.SetAttr ("binary_output", binary_output.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + + /// + /// Performs sparse-output bin counting for a ragged tensor input. + /// + /// + /// Tensor containing the row splits of the ragged tensor to count. + /// + /// + /// Tensor containing values of the sparse tensor to count. + /// + /// + /// A Tensor of the same shape as indices containing per-index weight values. + /// May also be the empty tensor if no weights are used. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'RaggedCountSparseOutput'. + /// + /// + /// Optional argument + /// Minimum value to count. Can be set to -1 for no minimum. + /// + /// + /// Optional argument + /// Maximum value to count. Can be set to -1 for no maximum. + /// + /// + /// Whether to output the number of occurrences of each value or 1. + /// + /// + /// Returns a tuple with multiple values, as follows: + /// output_indices: Indices tensor for the resulting sparse tensor object. + /// output_values: Values tensor for the resulting sparse tensor object. + /// output_dense_shape: Shape tensor for the resulting sparse tensor object. + /// END + /// } + /// attr { + /// name: "T" + /// description: &lt;&lt;END + /// Dtype of the input values tensor. + /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. + /// + /// + /// Counts the number of times each value occurs in the input. + /// + public (TFOutput output_indices, TFOutput output_values, TFOutput output_dense_shape) RaggedCountSparseOutput (TFOutput splits, TFOutput values, TFOutput weights, bool binary_output, long? minlength = null, long? maxlength = null, string operName = null) + { + var desc = new TFOperationDesc (this, "RaggedCountSparseOutput", MakeName ("RaggedCountSparseOutput", operName)); + desc.AddInput (splits); + desc.AddInput (values); + desc.AddInput (weights); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("binary_output", binary_output); + if (minlength.HasValue) + desc.SetAttr ("minlength", minlength.Value); + + if (maxlength.HasValue) + desc.SetAttr ("maxlength", maxlength.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var output_indices = new TFOutput (op, _idx++); + var output_values = new TFOutput (op, _idx++); + var output_dense_shape = new TFOutput (op, _idx++); + return (output_indices, output_values, output_dense_shape); + } + + /// + /// Generates a feature cross from a list of tensors, and returns it as a + /// RaggedTensor. See tf.ragged.cross for more details. + /// + /// + /// The values tensor for each RaggedTensor input. + /// + /// + /// The row_splits tensor for each RaggedTensor input. + /// + /// + /// The indices tensor for each SparseTensor input. + /// + /// + /// The values tensor for each SparseTensor input. + /// + /// + /// The dense_shape tensor for each SparseTensor input. + /// + /// + /// The tf.Tensor inputs. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'RaggedCross'. + /// + /// + /// String specifying the tensor type for each input. The ith character in + /// this string specifies the type of the ith input, and is one of: 'R' (ragged), + /// 'D' (dense), or 'S' (sparse). This attr is used to ensure that the crossed + /// values are combined in the order of the inputs from the call to tf.ragged.cross. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Returns a tuple with multiple values, as follows: + /// output_values: The values for the returned RaggedTensor. + /// output_row_splits: The row_splits for the returned RaggedTensor. + /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. + /// + public (TFOutput output_values, TFOutput output_row_splits) RaggedCross (TFOutput[] ragged_values, TFOutput[] ragged_row_splits, TFOutput[] sparse_indices, TFOutput[] sparse_values, TFOutput[] sparse_shape, TFOutput[] dense_inputs, string input_order, bool hashed_output, long num_buckets, long hash_key, TFDataType out_values_type, TFDataType out_row_splits_type, string operName = null) + { + var desc = new TFOperationDesc (this, "RaggedCross", MakeName ("RaggedCross", operName)); + desc.AddInputs (ragged_values); + desc.AddInputs (ragged_row_splits); + desc.AddInputs (sparse_indices); + desc.AddInputs (sparse_values); + desc.AddInputs (sparse_shape); + desc.AddInputs (dense_inputs); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("input_order", input_order); + desc.SetAttr ("hashed_output", hashed_output); + desc.SetAttr ("num_buckets", num_buckets); + desc.SetAttr ("hash_key", hash_key); + desc.SetAttrType ("out_values_type", out_values_type); + desc.SetAttrType ("out_row_splits_type", out_row_splits_type); + var op = desc.FinishOperation (); + int _idx = 0; + var output_values = new TFOutput (op, _idx++); + var output_row_splits = new TFOutput (op, _idx++); + return (output_values, output_row_splits); + } + /// /// Gather ragged slices from params axis 0 according to indices. /// @@ -34635,6 +38139,9 @@ public TFOutput QueueSizeV2 (TFOutput handle, string operName = null) /// /// If specified, the created operation in the graph will be this one, otherwise it will be named 'RaggedTensorFromVariant'. /// + /// + /// Optional argument + /// /// /// The ragged rank of each encoded RaggedTensor component in the input. If set to /// -1, this is inferred as output_ragged_rank - rank(encoded_ragged) @@ -34645,8 +38152,6 @@ public TFOutput QueueSizeV2 (TFOutput handle, string operName = null) /// /// /// - /// - /// /// /// Returns a tuple with multiple values, as follows: /// output_nested_splits: A list of one or more Tensors representing the splits of the output @@ -34668,7 +38173,7 @@ public TFOutput QueueSizeV2 (TFOutput handle, string operName = null) /// RaggedTensorToVariant for the corresponding encoding logic. /// /// - public (TFOutput[] output_nested_splits, TFOutput output_dense_values) RaggedTensorFromVariant (TFOutput encoded_ragged, long input_ragged_rank, long output_ragged_rank, TFDataType Tvalues, TFDataType Tsplits, string operName = null) + public (TFOutput[] output_nested_splits, TFOutput output_dense_values) RaggedTensorFromVariant (TFOutput encoded_ragged, long input_ragged_rank, long output_ragged_rank, TFDataType Tvalues, TFDataType? Tsplits = null, string operName = null) { var desc = new TFOperationDesc (this, "RaggedTensorFromVariant", MakeName ("RaggedTensorFromVariant", operName)); desc.AddInput (encoded_ragged); @@ -34678,7 +38183,9 @@ public TFOutput QueueSizeV2 (TFOutput handle, string operName = null) desc.SetAttr ("input_ragged_rank", input_ragged_rank); desc.SetAttr ("output_ragged_rank", output_ragged_rank); desc.SetAttrType ("Tvalues", Tvalues); - desc.SetAttrType ("Tsplits", Tsplits); + if (Tsplits.HasValue) + desc.SetAttrType ("Tsplits", Tsplits.Value); + var op = desc.FinishOperation (); int _idx = 0; int _n = 0; @@ -34735,7 +38242,7 @@ public TFOutput QueueSizeV2 (TFOutput handle, string operName = null) /// Create a dense tensor from a ragged tensor, possibly altering its shape. /// /// - /// The desired shape of the the output tensor. If left unspecified (empty), + /// The desired shape of the output tensor. If left unspecified (empty), /// the minimal shape required to contain all the elements in the ragged tensor /// (the natural shape) will be used. If some dimensions are left unspecified, then /// the size of the natural shape is used in that dimension. @@ -34867,6 +38374,50 @@ public TFOutput RaggedTensorToVariant (TFOutput[] rt_nested_splits, TFOutput rt_ return encoded_ragged; } + /// + /// Helper used to compute the gradient for RaggedTensorToVariant. + /// + /// + /// A variant Tensor containing encoded RaggedTensor gradients. + /// + /// + /// Outermost row-splits that were used as input to the RaggedTensorToVariant op. + /// + /// + /// Shape of the dense_values that was used as an input to the + /// RaggedTensorToVariant op. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'RaggedTensorToVariantGradient'. + /// + /// + /// + /// + /// Gradient for the dense_values of the RaggedTensorToVariant op. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Computes the gradient for the dense_values input to the RaggedTensorToVariant + /// op, given the variant-encoded ragged gradients of the outputs, along with + /// the outer row-splits and the shape of the dense-values that were provided as + /// inputs to the RaggedTensorToVariant op. + /// + public TFOutput RaggedTensorToVariantGradient (TFOutput encoded_ragged_grad, TFOutput row_splits, TFOutput dense_values_shape, TFDataType Tvalues, string operName = null) + { + var desc = new TFOperationDesc (this, "RaggedTensorToVariantGradient", MakeName ("RaggedTensorToVariantGradient", operName)); + desc.AddInput (encoded_ragged_grad); + desc.AddInput (row_splits); + desc.AddInput (dense_values_shape); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("Tvalues", Tvalues); + var op = desc.FinishOperation (); + int _idx = 0; + var dense_values_grad = new TFOutput (op, _idx++); + return dense_values_grad; + } + /// /// Randomly crop image. /// @@ -36285,6 +39836,49 @@ public TFOutput RebatchDataset (TFOutput input_dataset, TFOutput num_replicas, T return handle; } + /// + /// Creates a dataset that changes the batch size. + /// + /// + /// A variant tensor representing the input dataset. + /// + /// + /// A vector of integers representing the size of batches to produce. These values + /// are cycled through in order. + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'RebatchDatasetV2'. + /// + /// + /// + /// + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Creates a dataset that rebatches elements from input_dataset into new batch + /// sizes. + /// + public TFOutput RebatchDatasetV2 (TFOutput input_dataset, TFOutput batch_sizes, TFOutput drop_remainder, TFDataType[] output_types, TFShape[] output_shapes, string operName = null) + { + var desc = new TFOperationDesc (this, "RebatchDatasetV2", MakeName ("RebatchDatasetV2", operName)); + desc.AddInput (input_dataset); + desc.AddInput (batch_sizes); + desc.AddInput (drop_remainder); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("output_types", output_types); + desc.SetAttrShape ("output_shapes", output_shapes); + var op = desc.FinishOperation (); + int _idx = 0; + var handle = new TFOutput (op, _idx++); + return handle; + } + /// /// Computes the reciprocal of x element-wise. /// @@ -36413,6 +40007,57 @@ public TFOutput RecordInput (string file_pattern, long? file_random_seed = null, return records; } + /// + /// Receives the named tensor from send_device on recv_device. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Recv'. + /// + /// + /// Optional argument + /// If set to true, this indicates that the node was added + /// to the graph as a result of a client-side feed or fetch of Tensor data, + /// in which case the corresponding send or recv is expected to be managed + /// locally by the caller. + /// + /// + /// + /// + /// The name of the tensor to receive. + /// + /// + /// The name of the device sending the tensor. + /// + /// + /// The current incarnation of send_device. + /// + /// + /// The name of the device receiving the tensor. + /// + /// + /// The tensor to receive. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + public TFOutput Recv (TFDataType tensor_type, string tensor_name, string send_device, long send_device_incarnation, string recv_device, bool? client_terminated = null, string operName = null) + { + var desc = new TFOperationDesc (this, "Recv", MakeName ("Recv", operName)); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("tensor_type", tensor_type); + desc.SetAttr ("tensor_name", tensor_name); + desc.SetAttr ("send_device", send_device); + desc.SetAttr ("send_device_incarnation", send_device_incarnation); + desc.SetAttr ("recv_device", recv_device); + if (client_terminated.HasValue) + desc.SetAttr ("client_terminated", client_terminated.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var tensor = new TFOutput (op, _idx++); + return tensor; + } + /// /// An op that receives embedding activations on the TPU. /// @@ -36787,6 +40432,13 @@ public TFOutput RefSelect (TFOutput index, TFOutput[] inputs, string operName = /// if the input matches the regex pattern provided. /// /// The pattern follows the re2 syntax (https://github.com/google/re2/wiki/Syntax) + /// + /// Examples: + /// + /// &gt;&gt;&gt; tf.strings.regex_full_match(["TF lib", "lib TF"], ".*lib$") + /// &lt;tf.Tensor: shape=(2,), dtype=bool, numpy=array([ True, False])&gt; + /// &gt;&gt;&gt; tf.strings.regex_full_match(["TF lib", "lib TF"], ".*TF$") + /// &lt;tf.Tensor: shape=(2,), dtype=bool, numpy=array([False, True])&gt; /// public TFOutput RegexFullMatch (TFOutput input, TFOutput pattern, string operName = null) { @@ -36850,6 +40502,39 @@ public TFOutput RegexReplace (TFOutput input, TFOutput pattern, TFOutput rewrite return output; } + /// + /// Registers a dataset with the tf.data service. + /// + /// + /// + /// + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'RegisterDataset'. + /// + /// + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + public TFOutput RegisterDataset (TFOutput dataset, TFOutput address, TFOutput protocol, long external_state_policy, string operName = null) + { + var desc = new TFOperationDesc (this, "RegisterDataset", MakeName ("RegisterDataset", operName)); + desc.AddInput (dataset); + desc.AddInput (address); + desc.AddInput (protocol); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("external_state_policy", external_state_policy); + var op = desc.FinishOperation (); + int _idx = 0; + var dataset_id = new TFOutput (op, _idx++); + return dataset_id; + } + /// /// Computes rectified linear: max(features, 0). /// @@ -36864,8 +40549,8 @@ public TFOutput RegexReplace (TFOutput input, TFOutput pattern, TFOutput rewrite /// /// See: https://en.wikipedia.org/wiki/Rectifier_(neural_networks) /// Example usage: - /// &gt;&gt;&gt; tf.nn.relu([-2., 0., -0., 3.]).numpy() - /// array([ 0., 0., -0., 3.], dtype=float32) + /// &gt;&gt;&gt; tf.nn.relu([-2., 0., 3.]).numpy() + /// array([0., 0., 3.], dtype=float32) /// public TFOutput Relu (TFOutput features, string operName = null) { @@ -36967,54 +40652,6 @@ public TFOutput ReluGrad (TFOutput gradients, TFOutput features, string operName return backprops; } - /// - /// Execute a sub graph on a remote processor. - /// - /// - /// Arbitrary number of tensors with arbitrary data types - /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'RemoteFusedGraphExecute'. - /// - /// - /// - /// - /// Serialized protocol buffer - /// of RemoteFusedGraphExecuteInfo which contains graph specifications. - /// - /// - /// Arbitrary number of tensors with arbitrary data types - /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. - /// - /// - /// The graph specifications(such as graph itself, input tensors and output names) - /// are stored as a serialized protocol buffer of RemoteFusedGraphExecuteInfo - /// as serialized_remote_fused_graph_execute_info. - /// The specifications will be passed to a dedicated registered - /// remote fused graph executor. The executor will send the graph specifications - /// to a remote processor and execute that graph. The execution results - /// will be passed to consumer nodes as outputs of this node. - /// - public TFOutput[] RemoteFusedGraphExecute (TFOutput[] inputs, TFDataType[] Toutputs, string serialized_remote_fused_graph_execute_info, string operName = null) - { - var desc = new TFOperationDesc (this, "RemoteFusedGraphExecute", MakeName ("RemoteFusedGraphExecute", operName)); - desc.AddInputs (inputs); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - desc.SetAttrType ("Toutputs", Toutputs); - desc.SetAttr ("serialized_remote_fused_graph_execute_info", serialized_remote_fused_graph_execute_info); - var op = desc.FinishOperation (); - int _idx = 0; - int _n = 0; - _n = op.OutputListLength ("outputs"); - var outputs = new TFOutput [_n]; - for (int i = 0; i < _n; i++) - outputs [i] = new TFOutput (op, _idx++); - - return outputs; - } - /// /// Creates a dataset that emits the outputs of input_dataset count times. /// @@ -38015,7 +41652,7 @@ public TFOperation ResourceApplyAdagradDA (TFOutput var, TFOutput gradient_accum /// /// /// accum += grad * grad - /// var -= lr * grad * (1 / sqrt(accum)) + /// var -= lr * grad * (1 / (sqrt(accum) + epsilon)) /// public TFOperation ResourceApplyAdagradV2 (TFOutput var, TFOutput accum, TFOutput lr, TFOutput epsilon, TFOutput grad, bool? use_locking = null, bool? update_slots = null, string operName = null) { @@ -38088,10 +41725,10 @@ public TFOperation ResourceApplyAdagradV2 (TFOutput var, TFOutput accum, TFOutpu /// Returns the description of the operation /// /// - /// $$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)$$ + /// $$\text{lr}_t := \mathrm{lr} \cdot \frac{\sqrt{1 - \beta_2^t}}{1 - \beta_1^t}$$ + /// $$m_t := \beta_1 \cdot m_{t-1} + (1 - \beta_1) \cdot g$$ + /// $$v_t := \beta_2 \cdot v_{t-1} + (1 - \beta_2) \cdot g^2$$ + /// $$\text{var} := \begin{cases} \text{var} - (m_t \beta_1 + g \cdot (1 - \beta_1))\cdot\text{lr}_t/(\sqrt{v_t} + \epsilon), &\text{if use_nesterov}\\\\ \text{var} - m_t \cdot \text{lr}_t /(\sqrt{v_t} + \epsilon), &\text{otherwise} \end{cases}$$ /// public TFOperation ResourceApplyAdam (TFOutput var, TFOutput m, TFOutput v, TFOutput beta1_power, TFOutput beta2_power, TFOutput lr, TFOutput beta1, TFOutput beta2, TFOutput epsilon, TFOutput grad, bool? use_locking = null, bool? use_nesterov = null, string operName = null) { @@ -38237,11 +41874,11 @@ public TFOperation ResourceApplyAdaMax (TFOutput var, TFOutput m, TFOutput v, TF /// Returns the description of the operation /// /// - /// $$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$$ - /// $$vhat_t := max{vhat_{t-1}, v_t}$$ - /// $$variable := variable - lr_t * m_t / (\sqrt{vhat_t} + \epsilon)$$ + /// $$\text{lr}_t := \mathrm{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$$ + /// $$\hat{v}_t := max{\hat{v}_{t-1}, v_t}$$ + /// $$\text{variable} := \text{variable} - \text{lr}_t * m_t / (\sqrt{\hat{v}_t} + \epsilon)$$ /// public TFOperation ResourceApplyAdamWithAmsgrad (TFOutput var, TFOutput m, TFOutput v, TFOutput vhat, TFOutput beta1_power, TFOutput beta2_power, TFOutput lr, TFOutput beta1, TFOutput beta2, TFOutput epsilon, TFOutput grad, bool? use_locking = null, string operName = null) { @@ -38350,6 +41987,7 @@ public TFOperation ResourceApplyAddSign (TFOutput var, TFOutput m, TFOutput lr, /// Decay rate. Must be a scalar. /// /// + /// Momentum Scale. Must be a scalar. /// /// /// Ridge term. Must be a scalar. @@ -38430,10 +42068,10 @@ public TFOperation ResourceApplyCenteredRMSProp (TFOutput var, TFOutput mg, TFOu /// Scaling factor. Must be a scalar. /// /// - /// L1 regulariation. Must be a scalar. + /// L1 regularization. Must be a scalar. /// /// - /// L2 regulariation. Must be a scalar. + /// L2 regularization. Must be a scalar. /// /// /// Scaling factor. Must be a scalar. @@ -38447,6 +42085,9 @@ public TFOperation ResourceApplyCenteredRMSProp (TFOutput var, TFOutput mg, TFOu /// by a lock; otherwise the behavior is undefined, but may exhibit less /// contention. /// + /// + /// Optional argument + /// /// /// Returns the description of the operation /// @@ -38457,7 +42098,7 @@ public TFOperation ResourceApplyCenteredRMSProp (TFOutput var, TFOutput mg, TFOu /// var = (sign(linear) * l1 - linear) / quadratic if |linear| &gt; l1 else 0.0 /// accum = accum_new /// - public TFOperation ResourceApplyFtrl (TFOutput var, TFOutput accum, TFOutput linear, TFOutput grad, TFOutput lr, TFOutput l1, TFOutput l2, TFOutput lr_power, bool? use_locking = null, string operName = null) + public TFOperation ResourceApplyFtrl (TFOutput var, TFOutput accum, TFOutput linear, TFOutput grad, TFOutput lr, TFOutput l1, TFOutput l2, TFOutput lr_power, bool? use_locking = null, bool? multiply_linear_by_lr = null, string operName = null) { var desc = new TFOperationDesc (this, "ResourceApplyFtrl", MakeName ("ResourceApplyFtrl", operName)); desc.AddInput (var); @@ -38474,6 +42115,9 @@ public TFOperation ResourceApplyFtrl (TFOutput var, TFOutput accum, TFOutput lin if (use_locking.HasValue) desc.SetAttr ("use_locking", use_locking.Value); + if (multiply_linear_by_lr.HasValue) + desc.SetAttr ("multiply_linear_by_lr", multiply_linear_by_lr.Value); + var op = desc.FinishOperation (); return op; } @@ -38497,10 +42141,10 @@ public TFOperation ResourceApplyFtrl (TFOutput var, TFOutput accum, TFOutput lin /// Scaling factor. Must be a scalar. /// /// - /// L1 regulariation. Must be a scalar. + /// L1 regularization. Must be a scalar. /// /// - /// L2 shrinkage regulariation. Must be a scalar. + /// L2 shrinkage regularization. Must be a scalar. /// /// /// @@ -38516,19 +42160,22 @@ public TFOperation ResourceApplyFtrl (TFOutput var, TFOutput accum, TFOutput lin /// by a lock; otherwise the behavior is undefined, but may exhibit less /// contention. /// + /// + /// Optional argument + /// /// /// Returns the description of the operation /// /// + /// accum_new = accum + grad * grad /// 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| &gt; l1 else 0.0 /// accum = accum_new /// - public TFOperation ResourceApplyFtrlV2 (TFOutput var, TFOutput accum, TFOutput linear, TFOutput grad, TFOutput lr, TFOutput l1, TFOutput l2, TFOutput l2_shrinkage, TFOutput lr_power, bool? use_locking = null, string operName = null) + public TFOperation ResourceApplyFtrlV2 (TFOutput var, TFOutput accum, TFOutput linear, TFOutput grad, TFOutput lr, TFOutput l1, TFOutput l2, TFOutput l2_shrinkage, TFOutput lr_power, bool? use_locking = null, bool? multiply_linear_by_lr = null, string operName = null) { var desc = new TFOperationDesc (this, "ResourceApplyFtrlV2", MakeName ("ResourceApplyFtrlV2", operName)); desc.AddInput (var); @@ -38546,6 +42193,9 @@ public TFOperation ResourceApplyFtrlV2 (TFOutput var, TFOutput accum, TFOutput l if (use_locking.HasValue) desc.SetAttr ("use_locking", use_locking.Value); + if (multiply_linear_by_lr.HasValue) + desc.SetAttr ("multiply_linear_by_lr", multiply_linear_by_lr.Value); + var op = desc.FinishOperation (); return op; } @@ -38590,7 +42240,7 @@ public TFOperation ResourceApplyGradientDescent (TFOutput var, TFOutput alpha, T } /// - /// Update '*var' according to the momentum scheme. Set use_nesterov = True if you + /// Update '*var' according to the momentum scheme. /// /// /// Should be from a Variable(). @@ -38626,7 +42276,7 @@ public TFOperation ResourceApplyGradientDescent (TFOutput var, TFOutput alpha, T /// Returns the description of the operation /// /// - /// want to use Nesterov momentum. + /// Set use_nesterov = True if you want to use Nesterov momentum. /// /// accum = accum * momentum - lr * grad /// var += accum @@ -38653,7 +42303,7 @@ public TFOperation ResourceApplyKerasMomentum (TFOutput var, TFOutput accum, TFO } /// - /// Update '*var' according to the momentum scheme. Set use_nesterov = True if you + /// Update '*var' according to the momentum scheme. /// /// /// Should be from a Variable(). @@ -38689,7 +42339,7 @@ public TFOperation ResourceApplyKerasMomentum (TFOutput var, TFOutput accum, TFO /// Returns the description of the operation /// /// - /// want to use Nesterov momentum. + /// Set use_nesterov = True if you want to use Nesterov momentum. /// /// accum = accum * momentum + grad /// var -= lr * accum @@ -40063,6 +43713,9 @@ public TFOperation ResourceSparseApplyCenteredRMSProp (TFOutput var, TFOutput mg /// by a lock; otherwise the behavior is undefined, but may exhibit less /// contention. /// + /// + /// Optional argument + /// /// /// Returns the description of the operation /// @@ -40074,7 +43727,7 @@ public TFOperation ResourceSparseApplyCenteredRMSProp (TFOutput var, TFOutput mg /// var = (sign(linear) * l1 - linear) / quadratic if |linear| &gt; l1 else 0.0 /// accum = accum_new /// - public TFOperation ResourceSparseApplyFtrl (TFOutput var, TFOutput accum, TFOutput linear, TFOutput grad, TFOutput indices, TFOutput lr, TFOutput l1, TFOutput l2, TFOutput lr_power, bool? use_locking = null, string operName = null) + public TFOperation ResourceSparseApplyFtrl (TFOutput var, TFOutput accum, TFOutput linear, TFOutput grad, TFOutput indices, TFOutput lr, TFOutput l1, TFOutput l2, TFOutput lr_power, bool? use_locking = null, bool? multiply_linear_by_lr = null, string operName = null) { var desc = new TFOperationDesc (this, "ResourceSparseApplyFtrl", MakeName ("ResourceSparseApplyFtrl", operName)); desc.AddInput (var); @@ -40092,6 +43745,9 @@ public TFOperation ResourceSparseApplyFtrl (TFOutput var, TFOutput accum, TFOutp if (use_locking.HasValue) desc.SetAttr ("use_locking", use_locking.Value); + if (multiply_linear_by_lr.HasValue) + desc.SetAttr ("multiply_linear_by_lr", multiply_linear_by_lr.Value); + var op = desc.FinishOperation (); return op; } @@ -40121,7 +43777,7 @@ public TFOperation ResourceSparseApplyFtrl (TFOutput var, TFOutput accum, TFOutp /// L1 regularization. Must be a scalar. /// /// - /// L2 shrinkage regulariation. Must be a scalar. + /// L2 shrinkage regularization. Must be a scalar. /// /// /// @@ -40137,6 +43793,9 @@ public TFOperation ResourceSparseApplyFtrl (TFOutput var, TFOutput accum, TFOutp /// by a lock; otherwise the behavior is undefined, but may exhibit less /// contention. /// + /// + /// Optional argument + /// /// /// Returns the description of the operation /// @@ -40150,7 +43809,7 @@ public TFOperation ResourceSparseApplyFtrl (TFOutput var, TFOutput accum, TFOutp /// var = (sign(linear) * l1 - linear) / quadratic if |linear| &gt; l1 else 0.0 /// accum = accum_new /// - public TFOperation ResourceSparseApplyFtrlV2 (TFOutput var, TFOutput accum, TFOutput linear, TFOutput grad, TFOutput indices, TFOutput lr, TFOutput l1, TFOutput l2, TFOutput l2_shrinkage, TFOutput lr_power, bool? use_locking = null, string operName = null) + public TFOperation ResourceSparseApplyFtrlV2 (TFOutput var, TFOutput accum, TFOutput linear, TFOutput grad, TFOutput indices, TFOutput lr, TFOutput l1, TFOutput l2, TFOutput l2_shrinkage, TFOutput lr_power, bool? use_locking = null, bool? multiply_linear_by_lr = null, string operName = null) { var desc = new TFOperationDesc (this, "ResourceSparseApplyFtrlV2", MakeName ("ResourceSparseApplyFtrlV2", operName)); desc.AddInput (var); @@ -40169,6 +43828,9 @@ public TFOperation ResourceSparseApplyFtrlV2 (TFOutput var, TFOutput accum, TFOu if (use_locking.HasValue) desc.SetAttr ("use_locking", use_locking.Value); + if (multiply_linear_by_lr.HasValue) + desc.SetAttr ("multiply_linear_by_lr", multiply_linear_by_lr.Value); + var op = desc.FinishOperation (); return op; } @@ -40768,55 +44430,7 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh /// /// Optional argument /// - /// - /// - /// - /// - /// - /// Returns a tuple with multiple values, as follows: - /// parameters: Parameter parameters updated by the Adadelta optimization algorithm. - /// accumulators: Parameter accumulators updated by the Adadelta optimization algorithm. - /// updates: Parameter updates updated by the Adadelta optimization algorithm. - /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. - /// - /// - /// An op that retrieves optimization parameters from embedding to host - /// memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up - /// the correct embedding table configuration. For example, this op is - /// used to retrieve updated parameters before saving a checkpoint. - /// - public (TFOutput parameters, TFOutput accumulators, TFOutput updates) RetrieveTPUEmbeddingAdadeltaParameters (long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) - { - var desc = new TFOperationDesc (this, "RetrieveTPUEmbeddingAdadeltaParameters", MakeName ("RetrieveTPUEmbeddingAdadeltaParameters", operName)); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - desc.SetAttr ("num_shards", num_shards); - desc.SetAttr ("shard_id", shard_id); - if (table_id.HasValue) - desc.SetAttr ("table_id", table_id.Value); - - if (table_name != null) - desc.SetAttr ("table_name", table_name); - - var op = desc.FinishOperation (); - int _idx = 0; - var parameters = new TFOutput (op, _idx++); - var accumulators = new TFOutput (op, _idx++); - var updates = new TFOutput (op, _idx++); - return (parameters, accumulators, updates); - } - - /// - /// Retrieve Adadelta embedding parameters with debug support. - /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebug'. - /// - /// - /// Optional argument - /// - /// + /// /// Optional argument /// /// @@ -40828,7 +44442,6 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh /// parameters: Parameter parameters updated by the Adadelta optimization algorithm. /// accumulators: Parameter accumulators updated by the Adadelta optimization algorithm. /// updates: Parameter updates updated by the Adadelta optimization algorithm. - /// gradient_accumulators: Parameter gradient_accumulators updated by the Adadelta optimization algorithm. /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. /// /// @@ -40837,9 +44450,9 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh /// the correct embedding table configuration. For example, this op is /// used to retrieve updated parameters before saving a checkpoint. /// - public (TFOutput parameters, TFOutput accumulators, TFOutput updates, TFOutput gradient_accumulators) RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebug (long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) + public (TFOutput parameters, TFOutput accumulators, TFOutput updates) RetrieveTPUEmbeddingAdadeltaParameters (long num_shards, long shard_id, long? table_id = null, string table_name = null, string config = null, string operName = null) { - var desc = new TFOperationDesc (this, "RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebug", MakeName ("RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebug", operName)); + var desc = new TFOperationDesc (this, "RetrieveTPUEmbeddingAdadeltaParameters", MakeName ("RetrieveTPUEmbeddingAdadeltaParameters", operName)); foreach ( TFOperation control in CurrentDependencies ) desc.AddControlInput (control); @@ -40851,13 +44464,15 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh if (table_name != null) desc.SetAttr ("table_name", table_name); + if (config != null) + desc.SetAttr ("config", config); + var op = desc.FinishOperation (); int _idx = 0; var parameters = new TFOutput (op, _idx++); var accumulators = new TFOutput (op, _idx++); var updates = new TFOutput (op, _idx++); - var gradient_accumulators = new TFOutput (op, _idx++); - return (parameters, accumulators, updates, gradient_accumulators); + return (parameters, accumulators, updates); } /// @@ -40872,53 +44487,7 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh /// /// Optional argument /// - /// - /// - /// - /// - /// - /// Returns a tuple with multiple values, as follows: - /// parameters: Parameter parameters updated by the Adagrad optimization algorithm. - /// accumulators: Parameter accumulators updated by the Adagrad optimization algorithm. - /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. - /// - /// - /// An op that retrieves optimization parameters from embedding to host - /// memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up - /// the correct embedding table configuration. For example, this op is - /// used to retrieve updated parameters before saving a checkpoint. - /// - public (TFOutput parameters, TFOutput accumulators) RetrieveTPUEmbeddingAdagradParameters (long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) - { - var desc = new TFOperationDesc (this, "RetrieveTPUEmbeddingAdagradParameters", MakeName ("RetrieveTPUEmbeddingAdagradParameters", operName)); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - desc.SetAttr ("num_shards", num_shards); - desc.SetAttr ("shard_id", shard_id); - if (table_id.HasValue) - desc.SetAttr ("table_id", table_id.Value); - - if (table_name != null) - desc.SetAttr ("table_name", table_name); - - var op = desc.FinishOperation (); - int _idx = 0; - var parameters = new TFOutput (op, _idx++); - var accumulators = new TFOutput (op, _idx++); - return (parameters, accumulators); - } - - /// - /// Retrieve Adagrad embedding parameters with debug support. - /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'RetrieveTPUEmbeddingAdagradParametersGradAccumDebug'. - /// - /// - /// Optional argument - /// - /// + /// /// Optional argument /// /// @@ -40929,7 +44498,6 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh /// Returns a tuple with multiple values, as follows: /// parameters: Parameter parameters updated by the Adagrad optimization algorithm. /// accumulators: Parameter accumulators updated by the Adagrad optimization algorithm. - /// gradient_accumulators: Parameter gradient_accumulators updated by the Adagrad optimization algorithm. /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. /// /// @@ -40938,9 +44506,9 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh /// the correct embedding table configuration. For example, this op is /// used to retrieve updated parameters before saving a checkpoint. /// - public (TFOutput parameters, TFOutput accumulators, TFOutput gradient_accumulators) RetrieveTPUEmbeddingAdagradParametersGradAccumDebug (long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) + public (TFOutput parameters, TFOutput accumulators) RetrieveTPUEmbeddingAdagradParameters (long num_shards, long shard_id, long? table_id = null, string table_name = null, string config = null, string operName = null) { - var desc = new TFOperationDesc (this, "RetrieveTPUEmbeddingAdagradParametersGradAccumDebug", MakeName ("RetrieveTPUEmbeddingAdagradParametersGradAccumDebug", operName)); + var desc = new TFOperationDesc (this, "RetrieveTPUEmbeddingAdagradParameters", MakeName ("RetrieveTPUEmbeddingAdagradParameters", operName)); foreach ( TFOperation control in CurrentDependencies ) desc.AddControlInput (control); @@ -40952,12 +44520,14 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh if (table_name != null) desc.SetAttr ("table_name", table_name); + if (config != null) + desc.SetAttr ("config", config); + var op = desc.FinishOperation (); int _idx = 0; var parameters = new TFOutput (op, _idx++); var accumulators = new TFOutput (op, _idx++); - var gradient_accumulators = new TFOutput (op, _idx++); - return (parameters, accumulators, gradient_accumulators); + return (parameters, accumulators); } /// @@ -40972,6 +44542,9 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh /// /// Optional argument /// + /// + /// Optional argument + /// /// /// /// @@ -40989,7 +44562,7 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh /// the correct embedding table configuration. For example, this op is /// used to retrieve updated parameters before saving a checkpoint. /// - public (TFOutput parameters, TFOutput momenta, TFOutput velocities) RetrieveTPUEmbeddingADAMParameters (long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) + public (TFOutput parameters, TFOutput momenta, TFOutput velocities) RetrieveTPUEmbeddingADAMParameters (long num_shards, long shard_id, long? table_id = null, string table_name = null, string config = null, string operName = null) { var desc = new TFOperationDesc (this, "RetrieveTPUEmbeddingADAMParameters", MakeName ("RetrieveTPUEmbeddingADAMParameters", operName)); foreach ( TFOperation control in CurrentDependencies ) @@ -41003,65 +44576,15 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh if (table_name != null) desc.SetAttr ("table_name", table_name); - var op = desc.FinishOperation (); - int _idx = 0; - var parameters = new TFOutput (op, _idx++); - var momenta = new TFOutput (op, _idx++); - var velocities = new TFOutput (op, _idx++); - return (parameters, momenta, velocities); - } - - /// - /// Retrieve ADAM embedding parameters with debug support. - /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'RetrieveTPUEmbeddingADAMParametersGradAccumDebug'. - /// - /// - /// Optional argument - /// - /// - /// Optional argument - /// - /// - /// - /// - /// - /// - /// Returns a tuple with multiple values, as follows: - /// parameters: Parameter parameters updated by the ADAM optimization algorithm. - /// momenta: Parameter momenta updated by the ADAM optimization algorithm. - /// velocities: Parameter velocities updated by the ADAM optimization algorithm. - /// gradient_accumulators: Parameter gradient_accumulators updated by the ADAM optimization algorithm. - /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. - /// - /// - /// An op that retrieves optimization parameters from embedding to host - /// memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up - /// the correct embedding table configuration. For example, this op is - /// used to retrieve updated parameters before saving a checkpoint. - /// - public (TFOutput parameters, TFOutput momenta, TFOutput velocities, TFOutput gradient_accumulators) RetrieveTPUEmbeddingADAMParametersGradAccumDebug (long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) - { - var desc = new TFOperationDesc (this, "RetrieveTPUEmbeddingADAMParametersGradAccumDebug", MakeName ("RetrieveTPUEmbeddingADAMParametersGradAccumDebug", operName)); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - desc.SetAttr ("num_shards", num_shards); - desc.SetAttr ("shard_id", shard_id); - if (table_id.HasValue) - desc.SetAttr ("table_id", table_id.Value); - - if (table_name != null) - desc.SetAttr ("table_name", table_name); + if (config != null) + desc.SetAttr ("config", config); var op = desc.FinishOperation (); int _idx = 0; var parameters = new TFOutput (op, _idx++); var momenta = new TFOutput (op, _idx++); var velocities = new TFOutput (op, _idx++); - var gradient_accumulators = new TFOutput (op, _idx++); - return (parameters, momenta, velocities, gradient_accumulators); + return (parameters, momenta, velocities); } /// @@ -41076,6 +44599,9 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh /// /// Optional argument /// + /// + /// Optional argument + /// /// /// /// @@ -41094,7 +44620,7 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh /// the correct embedding table configuration. For example, this op is /// used to retrieve updated parameters before saving a checkpoint. /// - public (TFOutput parameters, TFOutput ms, TFOutput mom, TFOutput mg) RetrieveTPUEmbeddingCenteredRMSPropParameters (long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) + public (TFOutput parameters, TFOutput ms, TFOutput mom, TFOutput mg) RetrieveTPUEmbeddingCenteredRMSPropParameters (long num_shards, long shard_id, long? table_id = null, string table_name = null, string config = null, string operName = null) { var desc = new TFOperationDesc (this, "RetrieveTPUEmbeddingCenteredRMSPropParameters", MakeName ("RetrieveTPUEmbeddingCenteredRMSPropParameters", operName)); foreach ( TFOperation control in CurrentDependencies ) @@ -41108,6 +44634,9 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh if (table_name != null) desc.SetAttr ("table_name", table_name); + if (config != null) + desc.SetAttr ("config", config); + var op = desc.FinishOperation (); int _idx = 0; var parameters = new TFOutput (op, _idx++); @@ -41118,10 +44647,10 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh } /// - /// Retrieve FTRL embedding parameters. + /// Retrieve frequency estimator embedding parameters. /// /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'RetrieveTPUEmbeddingFTRLParameters'. + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'RetrieveTPUEmbeddingFrequencyEstimatorParameters'. /// /// /// Optional argument @@ -41129,15 +44658,18 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh /// /// Optional argument /// + /// + /// Optional argument + /// /// /// /// /// /// /// Returns a tuple with multiple values, as follows: - /// parameters: Parameter parameters updated by the FTRL optimization algorithm. - /// accumulators: Parameter accumulators updated by the FTRL optimization algorithm. - /// linears: Parameter linears updated by the FTRL optimization algorithm. + /// parameters: Parameter parameters updated by the frequency estimator optimization algorithm. + /// last_hit_step: Parameter last_hit_step updated by the frequency estimator optimization + /// algorithm. /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. /// /// @@ -41146,9 +44678,9 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh /// the correct embedding table configuration. For example, this op is /// used to retrieve updated parameters before saving a checkpoint. /// - public (TFOutput parameters, TFOutput accumulators, TFOutput linears) RetrieveTPUEmbeddingFTRLParameters (long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) + public (TFOutput parameters, TFOutput last_hit_step) RetrieveTPUEmbeddingFrequencyEstimatorParameters (long num_shards, long shard_id, long? table_id = null, string table_name = null, string config = null, string operName = null) { - var desc = new TFOperationDesc (this, "RetrieveTPUEmbeddingFTRLParameters", MakeName ("RetrieveTPUEmbeddingFTRLParameters", operName)); + var desc = new TFOperationDesc (this, "RetrieveTPUEmbeddingFrequencyEstimatorParameters", MakeName ("RetrieveTPUEmbeddingFrequencyEstimatorParameters", operName)); foreach ( TFOperation control in CurrentDependencies ) desc.AddControlInput (control); @@ -41160,19 +44692,21 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh if (table_name != null) desc.SetAttr ("table_name", table_name); + if (config != null) + desc.SetAttr ("config", config); + var op = desc.FinishOperation (); int _idx = 0; var parameters = new TFOutput (op, _idx++); - var accumulators = new TFOutput (op, _idx++); - var linears = new TFOutput (op, _idx++); - return (parameters, accumulators, linears); + var last_hit_step = new TFOutput (op, _idx++); + return (parameters, last_hit_step); } /// - /// Retrieve FTRL embedding parameters with debug support. + /// Retrieve FTRL embedding parameters. /// /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'RetrieveTPUEmbeddingFTRLParametersGradAccumDebug'. + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'RetrieveTPUEmbeddingFTRLParameters'. /// /// /// Optional argument @@ -41180,6 +44714,9 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh /// /// Optional argument /// + /// + /// Optional argument + /// /// /// /// @@ -41189,7 +44726,6 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh /// parameters: Parameter parameters updated by the FTRL optimization algorithm. /// accumulators: Parameter accumulators updated by the FTRL optimization algorithm. /// linears: Parameter linears updated by the FTRL optimization algorithm. - /// gradient_accumulators: Parameter gradient_accumulators updated by the FTRL optimization algorithm. /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. /// /// @@ -41198,9 +44734,9 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh /// the correct embedding table configuration. For example, this op is /// used to retrieve updated parameters before saving a checkpoint. /// - public (TFOutput parameters, TFOutput accumulators, TFOutput linears, TFOutput gradient_accumulators) RetrieveTPUEmbeddingFTRLParametersGradAccumDebug (long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) + public (TFOutput parameters, TFOutput accumulators, TFOutput linears) RetrieveTPUEmbeddingFTRLParameters (long num_shards, long shard_id, long? table_id = null, string table_name = null, string config = null, string operName = null) { - var desc = new TFOperationDesc (this, "RetrieveTPUEmbeddingFTRLParametersGradAccumDebug", MakeName ("RetrieveTPUEmbeddingFTRLParametersGradAccumDebug", operName)); + var desc = new TFOperationDesc (this, "RetrieveTPUEmbeddingFTRLParameters", MakeName ("RetrieveTPUEmbeddingFTRLParameters", operName)); foreach ( TFOperation control in CurrentDependencies ) desc.AddControlInput (control); @@ -41212,13 +44748,15 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh if (table_name != null) desc.SetAttr ("table_name", table_name); + if (config != null) + desc.SetAttr ("config", config); + var op = desc.FinishOperation (); int _idx = 0; var parameters = new TFOutput (op, _idx++); var accumulators = new TFOutput (op, _idx++); var linears = new TFOutput (op, _idx++); - var gradient_accumulators = new TFOutput (op, _idx++); - return (parameters, accumulators, linears, gradient_accumulators); + return (parameters, accumulators, linears); } /// @@ -41233,6 +44771,9 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh /// /// Optional argument /// + /// + /// Optional argument + /// /// /// /// @@ -41251,7 +44792,7 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh /// the correct embedding table configuration. For example, this op is /// used to retrieve updated parameters before saving a checkpoint. /// - public (TFOutput parameters, TFOutput accumulators, TFOutput weights, TFOutput benefits) RetrieveTPUEmbeddingMDLAdagradLightParameters (long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) + public (TFOutput parameters, TFOutput accumulators, TFOutput weights, TFOutput benefits) RetrieveTPUEmbeddingMDLAdagradLightParameters (long num_shards, long shard_id, long? table_id = null, string table_name = null, string config = null, string operName = null) { var desc = new TFOperationDesc (this, "RetrieveTPUEmbeddingMDLAdagradLightParameters", MakeName ("RetrieveTPUEmbeddingMDLAdagradLightParameters", operName)); foreach ( TFOperation control in CurrentDependencies ) @@ -41265,6 +44806,9 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh if (table_name != null) desc.SetAttr ("table_name", table_name); + if (config != null) + desc.SetAttr ("config", config); + var op = desc.FinishOperation (); int _idx = 0; var parameters = new TFOutput (op, _idx++); @@ -41286,53 +44830,7 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh /// /// Optional argument /// - /// - /// - /// - /// - /// - /// Returns a tuple with multiple values, as follows: - /// parameters: Parameter parameters updated by the Momentum optimization algorithm. - /// momenta: Parameter momenta updated by the Momentum optimization algorithm. - /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. - /// - /// - /// An op that retrieves optimization parameters from embedding to host - /// memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up - /// the correct embedding table configuration. For example, this op is - /// used to retrieve updated parameters before saving a checkpoint. - /// - public (TFOutput parameters, TFOutput momenta) RetrieveTPUEmbeddingMomentumParameters (long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) - { - var desc = new TFOperationDesc (this, "RetrieveTPUEmbeddingMomentumParameters", MakeName ("RetrieveTPUEmbeddingMomentumParameters", operName)); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - desc.SetAttr ("num_shards", num_shards); - desc.SetAttr ("shard_id", shard_id); - if (table_id.HasValue) - desc.SetAttr ("table_id", table_id.Value); - - if (table_name != null) - desc.SetAttr ("table_name", table_name); - - var op = desc.FinishOperation (); - int _idx = 0; - var parameters = new TFOutput (op, _idx++); - var momenta = new TFOutput (op, _idx++); - return (parameters, momenta); - } - - /// - /// Retrieve Momentum embedding parameters with debug support. - /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'RetrieveTPUEmbeddingMomentumParametersGradAccumDebug'. - /// - /// - /// Optional argument - /// - /// + /// /// Optional argument /// /// @@ -41343,7 +44841,6 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh /// Returns a tuple with multiple values, as follows: /// parameters: Parameter parameters updated by the Momentum optimization algorithm. /// momenta: Parameter momenta updated by the Momentum optimization algorithm. - /// gradient_accumulators: Parameter gradient_accumulators updated by the Momentum optimization algorithm. /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. /// /// @@ -41352,9 +44849,9 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh /// the correct embedding table configuration. For example, this op is /// used to retrieve updated parameters before saving a checkpoint. /// - public (TFOutput parameters, TFOutput momenta, TFOutput gradient_accumulators) RetrieveTPUEmbeddingMomentumParametersGradAccumDebug (long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) + public (TFOutput parameters, TFOutput momenta) RetrieveTPUEmbeddingMomentumParameters (long num_shards, long shard_id, long? table_id = null, string table_name = null, string config = null, string operName = null) { - var desc = new TFOperationDesc (this, "RetrieveTPUEmbeddingMomentumParametersGradAccumDebug", MakeName ("RetrieveTPUEmbeddingMomentumParametersGradAccumDebug", operName)); + var desc = new TFOperationDesc (this, "RetrieveTPUEmbeddingMomentumParameters", MakeName ("RetrieveTPUEmbeddingMomentumParameters", operName)); foreach ( TFOperation control in CurrentDependencies ) desc.AddControlInput (control); @@ -41366,12 +44863,14 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh if (table_name != null) desc.SetAttr ("table_name", table_name); + if (config != null) + desc.SetAttr ("config", config); + var op = desc.FinishOperation (); int _idx = 0; var parameters = new TFOutput (op, _idx++); var momenta = new TFOutput (op, _idx++); - var gradient_accumulators = new TFOutput (op, _idx++); - return (parameters, momenta, gradient_accumulators); + return (parameters, momenta); } /// @@ -41386,53 +44885,7 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh /// /// Optional argument /// - /// - /// - /// - /// - /// - /// Returns a tuple with multiple values, as follows: - /// parameters: Parameter parameters updated by the proximal Adagrad optimization algorithm. - /// accumulators: Parameter accumulators updated by the proximal Adagrad optimization algorithm. - /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. - /// - /// - /// An op that retrieves optimization parameters from embedding to host - /// memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up - /// the correct embedding table configuration. For example, this op is - /// used to retrieve updated parameters before saving a checkpoint. - /// - public (TFOutput parameters, TFOutput accumulators) RetrieveTPUEmbeddingProximalAdagradParameters (long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) - { - var desc = new TFOperationDesc (this, "RetrieveTPUEmbeddingProximalAdagradParameters", MakeName ("RetrieveTPUEmbeddingProximalAdagradParameters", operName)); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - desc.SetAttr ("num_shards", num_shards); - desc.SetAttr ("shard_id", shard_id); - if (table_id.HasValue) - desc.SetAttr ("table_id", table_id.Value); - - if (table_name != null) - desc.SetAttr ("table_name", table_name); - - var op = desc.FinishOperation (); - int _idx = 0; - var parameters = new TFOutput (op, _idx++); - var accumulators = new TFOutput (op, _idx++); - return (parameters, accumulators); - } - - /// - /// Retrieve proximal Adagrad embedding parameters with debug support. - /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebug'. - /// - /// - /// Optional argument - /// - /// + /// /// Optional argument /// /// @@ -41443,7 +44896,6 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh /// Returns a tuple with multiple values, as follows: /// parameters: Parameter parameters updated by the proximal Adagrad optimization algorithm. /// accumulators: Parameter accumulators updated by the proximal Adagrad optimization algorithm. - /// gradient_accumulators: Parameter gradient_accumulators updated by the proximal Adagrad optimization algorithm. /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. /// /// @@ -41452,9 +44904,9 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh /// the correct embedding table configuration. For example, this op is /// used to retrieve updated parameters before saving a checkpoint. /// - public (TFOutput parameters, TFOutput accumulators, TFOutput gradient_accumulators) RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebug (long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) + public (TFOutput parameters, TFOutput accumulators) RetrieveTPUEmbeddingProximalAdagradParameters (long num_shards, long shard_id, long? table_id = null, string table_name = null, string config = null, string operName = null) { - var desc = new TFOperationDesc (this, "RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebug", MakeName ("RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebug", operName)); + var desc = new TFOperationDesc (this, "RetrieveTPUEmbeddingProximalAdagradParameters", MakeName ("RetrieveTPUEmbeddingProximalAdagradParameters", operName)); foreach ( TFOperation control in CurrentDependencies ) desc.AddControlInput (control); @@ -41466,12 +44918,14 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh if (table_name != null) desc.SetAttr ("table_name", table_name); + if (config != null) + desc.SetAttr ("config", config); + var op = desc.FinishOperation (); int _idx = 0; var parameters = new TFOutput (op, _idx++); var accumulators = new TFOutput (op, _idx++); - var gradient_accumulators = new TFOutput (op, _idx++); - return (parameters, accumulators, gradient_accumulators); + return (parameters, accumulators); } /// @@ -41486,55 +44940,7 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh /// /// Optional argument /// - /// - /// - /// - /// - /// - /// Returns a tuple with multiple values, as follows: - /// parameters: Parameter parameters updated by the RMSProp optimization algorithm. - /// ms: Parameter ms updated by the RMSProp optimization algorithm. - /// mom: Parameter mom updated by the RMSProp optimization algorithm. - /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. - /// - /// - /// An op that retrieves optimization parameters from embedding to host - /// memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up - /// the correct embedding table configuration. For example, this op is - /// used to retrieve updated parameters before saving a checkpoint. - /// - public (TFOutput parameters, TFOutput ms, TFOutput mom) RetrieveTPUEmbeddingRMSPropParameters (long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) - { - var desc = new TFOperationDesc (this, "RetrieveTPUEmbeddingRMSPropParameters", MakeName ("RetrieveTPUEmbeddingRMSPropParameters", operName)); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - desc.SetAttr ("num_shards", num_shards); - desc.SetAttr ("shard_id", shard_id); - if (table_id.HasValue) - desc.SetAttr ("table_id", table_id.Value); - - if (table_name != null) - desc.SetAttr ("table_name", table_name); - - var op = desc.FinishOperation (); - int _idx = 0; - var parameters = new TFOutput (op, _idx++); - var ms = new TFOutput (op, _idx++); - var mom = new TFOutput (op, _idx++); - return (parameters, ms, mom); - } - - /// - /// Retrieve RMSProp embedding parameters with debug support. - /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'RetrieveTPUEmbeddingRMSPropParametersGradAccumDebug'. - /// - /// - /// Optional argument - /// - /// + /// /// Optional argument /// /// @@ -41546,7 +44952,6 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh /// parameters: Parameter parameters updated by the RMSProp optimization algorithm. /// ms: Parameter ms updated by the RMSProp optimization algorithm. /// mom: Parameter mom updated by the RMSProp optimization algorithm. - /// gradient_accumulators: Parameter gradient_accumulators updated by the RMSProp optimization algorithm. /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. /// /// @@ -41555,9 +44960,9 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh /// the correct embedding table configuration. For example, this op is /// used to retrieve updated parameters before saving a checkpoint. /// - public (TFOutput parameters, TFOutput ms, TFOutput mom, TFOutput gradient_accumulators) RetrieveTPUEmbeddingRMSPropParametersGradAccumDebug (long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) + public (TFOutput parameters, TFOutput ms, TFOutput mom) RetrieveTPUEmbeddingRMSPropParameters (long num_shards, long shard_id, long? table_id = null, string table_name = null, string config = null, string operName = null) { - var desc = new TFOperationDesc (this, "RetrieveTPUEmbeddingRMSPropParametersGradAccumDebug", MakeName ("RetrieveTPUEmbeddingRMSPropParametersGradAccumDebug", operName)); + var desc = new TFOperationDesc (this, "RetrieveTPUEmbeddingRMSPropParameters", MakeName ("RetrieveTPUEmbeddingRMSPropParameters", operName)); foreach ( TFOperation control in CurrentDependencies ) desc.AddControlInput (control); @@ -41569,13 +44974,15 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh if (table_name != null) desc.SetAttr ("table_name", table_name); + if (config != null) + desc.SetAttr ("config", config); + var op = desc.FinishOperation (); int _idx = 0; var parameters = new TFOutput (op, _idx++); var ms = new TFOutput (op, _idx++); var mom = new TFOutput (op, _idx++); - var gradient_accumulators = new TFOutput (op, _idx++); - return (parameters, ms, mom, gradient_accumulators); + return (parameters, ms, mom); } /// @@ -41590,6 +44997,9 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh /// /// Optional argument /// + /// + /// Optional argument + /// /// /// /// @@ -41604,7 +45014,7 @@ public TFOutput[] RestoreV2 (TFOutput prefix, TFOutput tensor_names, TFOutput sh /// the correct embedding table configuration. For example, this op is /// used to retrieve updated parameters before saving a checkpoint. /// - public TFOutput RetrieveTPUEmbeddingStochasticGradientDescentParameters (long num_shards, long shard_id, long? table_id = null, string table_name = null, string operName = null) + public TFOutput RetrieveTPUEmbeddingStochasticGradientDescentParameters (long num_shards, long shard_id, long? table_id = null, string table_name = null, string config = null, string operName = null) { var desc = new TFOperationDesc (this, "RetrieveTPUEmbeddingStochasticGradientDescentParameters", MakeName ("RetrieveTPUEmbeddingStochasticGradientDescentParameters", operName)); foreach ( TFOperation control in CurrentDependencies ) @@ -41618,6 +45028,9 @@ public TFOutput RetrieveTPUEmbeddingStochasticGradientDescentParameters (long nu if (table_name != null) desc.SetAttr ("table_name", table_name); + if (config != null) + desc.SetAttr ("config", config); + var op = desc.FinishOperation (); int _idx = 0; var parameters = new TFOutput (op, _idx++); @@ -41816,9 +45229,6 @@ public TFOutput ReverseSequence (TFOutput input, TFOutput seq_lengths, long seq_ /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// /// - /// NOTE tf.reverse has now changed behavior in preparation for 1.0. - /// tf.reverse_v2 is currently an alias that will be deprecated before TF 1.0. - /// /// Given a tensor, and a int32 tensor axis representing the set of /// dimensions of tensor to reverse. This operation reverses each dimension /// i for which there exists j s.t. axis[j] == i. @@ -41889,6 +45299,9 @@ public TFOutput ReverseV2 (TFOutput tensor, TFOutput axis, string operName = nul /// /// If specified, the created operation in the graph will be this one, otherwise it will be named 'RFFT'. /// + /// + /// Optional argument + /// /// /// A complex64 tensor of the same rank as input. The inner-most /// dimension of input is replaced with the fft_length / 2 + 1 unique @@ -41911,7 +45324,7 @@ public TFOutput ReverseV2 (TFOutput tensor, TFOutput axis, string operName = nul /// corresponding dimension of input, the dimension is cropped. If it is larger, /// the dimension is padded with zeros. /// - public TFOutput RFFT (TFOutput input, TFOutput fft_length, string operName = null) + public TFOutput RFFT (TFOutput input, TFOutput fft_length, TFDataType? Tcomplex = null, string operName = null) { var desc = new TFOperationDesc (this, "RFFT", MakeName ("RFFT", operName)); desc.AddInput (input); @@ -41919,6 +45332,9 @@ public TFOutput RFFT (TFOutput input, TFOutput fft_length, string operName = nul foreach ( TFOperation control in CurrentDependencies ) desc.AddControlInput (control); + if (Tcomplex.HasValue) + desc.SetAttrType ("Tcomplex", Tcomplex.Value); + var op = desc.FinishOperation (); int _idx = 0; var output = new TFOutput (op, _idx++); @@ -41937,6 +45353,9 @@ public TFOutput RFFT (TFOutput input, TFOutput fft_length, string operName = nul /// /// If specified, the created operation in the graph will be this one, otherwise it will be named 'RFFT2D'. /// + /// + /// Optional argument + /// /// /// A complex64 tensor of the same rank as input. The inner-most 2 /// dimensions of input are replaced with their 2D Fourier transform. The @@ -41961,7 +45380,7 @@ public TFOutput RFFT (TFOutput input, TFOutput fft_length, string operName = nul /// corresponding dimension of input, the dimension is cropped. If it is larger, /// the dimension is padded with zeros. /// - public TFOutput RFFT2D (TFOutput input, TFOutput fft_length, string operName = null) + public TFOutput RFFT2D (TFOutput input, TFOutput fft_length, TFDataType? Tcomplex = null, string operName = null) { var desc = new TFOperationDesc (this, "RFFT2D", MakeName ("RFFT2D", operName)); desc.AddInput (input); @@ -41969,6 +45388,9 @@ public TFOutput RFFT2D (TFOutput input, TFOutput fft_length, string operName = n foreach ( TFOperation control in CurrentDependencies ) desc.AddControlInput (control); + if (Tcomplex.HasValue) + desc.SetAttrType ("Tcomplex", Tcomplex.Value); + var op = desc.FinishOperation (); int _idx = 0; var output = new TFOutput (op, _idx++); @@ -41987,6 +45409,9 @@ public TFOutput RFFT2D (TFOutput input, TFOutput fft_length, string operName = n /// /// If specified, the created operation in the graph will be this one, otherwise it will be named 'RFFT3D'. /// + /// + /// Optional argument + /// /// /// A complex64 tensor of the same rank as input. The inner-most 3 /// dimensions of input are replaced with the their 3D Fourier transform. The @@ -42011,7 +45436,7 @@ public TFOutput RFFT2D (TFOutput input, TFOutput fft_length, string operName = n /// corresponding dimension of input, the dimension is cropped. If it is larger, /// the dimension is padded with zeros. /// - public TFOutput RFFT3D (TFOutput input, TFOutput fft_length, string operName = null) + public TFOutput RFFT3D (TFOutput input, TFOutput fft_length, TFDataType? Tcomplex = null, string operName = null) { var desc = new TFOperationDesc (this, "RFFT3D", MakeName ("RFFT3D", operName)); desc.AddInput (input); @@ -42019,6 +45444,9 @@ public TFOutput RFFT3D (TFOutput input, TFOutput fft_length, string operName = n foreach ( TFOperation control in CurrentDependencies ) desc.AddControlInput (control); + if (Tcomplex.HasValue) + desc.SetAttrType ("Tcomplex", Tcomplex.Value); + var op = desc.FinishOperation (); int _idx = 0; var output = new TFOutput (op, _idx++); @@ -42046,6 +45474,18 @@ public TFOutput RFFT3D (TFOutput input, TFOutput fft_length, string operName = n /// output[..., 0] contains hue, output[..., 1] contains saturation, and /// output[..., 2] contains value. All HSV values are in [0,1]. A hue of 0 /// corresponds to pure red, hue 1/3 is pure green, and 2/3 is pure blue. + /// + /// Usage Example: + /// + /// &gt;&gt;&gt; blue_image = tf.stack([ + /// ... tf.zeros([5,5]), + /// ... tf.zeros([5,5]), + /// ... tf.ones([5,5])], + /// ... axis=-1) + /// &gt;&gt;&gt; blue_hsv_image = tf.image.rgb_to_hsv(blue_image) + /// &gt;&gt;&gt; blue_hsv_image[0,0].numpy() + /// array([0.6666667, 1. , 1. ], dtype=float32) + /// /// public TFOutput RGBToHSV (TFOutput images, string operName = null) { @@ -42158,6 +45598,114 @@ public TFOutput Rint (TFOutput x, string operName = null) return y; } + /// + /// Returns x + y element-wise. + /// + /// + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'RiscAdd'. + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// *NOTE*: RiscAdd does not supports broadcasting. + /// + /// Given two input tensors, the tf.risc_add operation computes the sum for every element in the tensor. + /// + /// Both input and output have a range (-inf, inf). + /// + /// + public TFOutput RiscAdd (TFOutput x, TFOutput y, string operName = null) + { + var desc = new TFOperationDesc (this, "RiscAdd", MakeName ("RiscAdd", operName)); + desc.AddInput (x); + desc.AddInput (y); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var z = new TFOutput (op, _idx++); + return z; + } + + /// + /// Returns max(x, y) element-wise. + /// + /// + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'RiscMax'. + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// *NOTE*: RiscMax does not supports broadcasting. + /// + /// Given two input tensors, the tf.risc_max operation computes the maximum for every element in the tensor. + /// + /// + public TFOutput RiscMax (TFOutput x, TFOutput y, string operName = null) + { + var desc = new TFOperationDesc (this, "RiscMax", MakeName ("RiscMax", operName)); + desc.AddInput (x); + desc.AddInput (y); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var max = new TFOutput (op, _idx++); + return max; + } + + /// + /// Advance the counter of a counter-based RNG. + /// + /// + /// The handle of the resource variable that stores the state of the RNG. + /// + /// + /// The RNG algorithm. + /// + /// + /// The amount of advancement. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'RngReadAndSkip'. + /// + /// + /// The old value of the resource variable, before incrementing. Since state size is algorithm-dependent, this output will be right-padded with zeros to reach shape int64[3] (the current maximal state size among algorithms). + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// The state of the RNG after + /// rng_read_and_skip(n) will be the same as that after uniform([n]) + /// (or any other distribution). The actual increment added to the + /// counter is an unspecified implementation choice. + /// + public TFOutput RngReadAndSkip (TFOutput resource, TFOutput alg, TFOutput delta, string operName = null) + { + var desc = new TFOperationDesc (this, "RngReadAndSkip", MakeName ("RngReadAndSkip", operName)); + desc.AddInput (resource); + desc.AddInput (alg); + desc.AddInput (delta); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var value = new TFOutput (op, _idx++); + return value; + } + /// /// Advance the counter of a counter-based RNG. /// @@ -42286,121 +45834,6 @@ public TFOutput Round (TFOutput x, string operName = null) return y; } - /// - /// Perform batches of RPC requests. - /// - /// - /// 0-D or 1-D. The address (i.e. host_name:port) of the RPC server. - /// If this tensor has more than 1 element, then multiple parallel rpc requests - /// are sent. This argument broadcasts with method and request. - /// - /// - /// 0-D or 1-D. The method address on the RPC server. - /// If this tensor has more than 1 element, then multiple parallel rpc requests - /// are sent. This argument broadcasts with address and request. - /// - /// - /// 0-D or 1-D. Serialized proto strings: the rpc request argument. - /// If this tensor has more than 1 element, then multiple parallel rpc requests - /// are sent. This argument broadcasts with address and method. - /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Rpc'. - /// - /// - /// Optional argument - /// RPC protocol to use. Empty string means use the default protocol. - /// Options include 'grpc'. - /// - /// - /// Optional argument - /// boolean. If true (default), then failures to connect - /// (i.e., the server does not immediately respond) cause an RPC failure. - /// - /// - /// Optional argument - /// int. If 0 (default), then the kernel will run the RPC - /// request and only time out if the RPC deadline passes or the session times out. - /// If this value is greater than 0, then the op will raise an exception if - /// the RPC takes longer than timeout_in_ms. - /// - /// - /// Same shape as request. Serialized proto strings: the rpc responses. - /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. - /// - /// - /// This op asynchronously performs either a single RPC request, or a batch - /// of requests. RPC requests are defined by three main parameters: - /// - /// - address (the host+port or BNS address of the request) - /// - method (the RPC method name for the request) - /// - request (the serialized proto string, or vector of strings, - /// of the RPC request argument). - /// - /// For example, if you have an RPC service running on port localhost:2345, - /// and its interface is configured with the following proto declaration: - /// - /// - /// service MyService { - /// rpc MyMethod(MyRequestProto) returns (MyResponseProto) { - /// } - /// }; - /// - /// - /// then call this op with arguments: - /// - /// - /// address = "localhost:2345" - /// method = "MyService/MyMethod" - /// - /// - /// The request tensor is a string tensor representing serialized MyRequestProto - /// strings; and the output string tensor response will have the same shape - /// and contain (upon successful completion) corresponding serialized - /// MyResponseProto strings. - /// - /// For example, to send a single, empty, MyRequestProto, call - /// this op with request = "". To send 5 **parallel** empty requests, - /// call this op with request = ["", "", "", "", ""]. - /// - /// More generally, one can create a batch of MyRequestProto serialized protos - /// from regular batched tensors using the encode_proto op, and convert - /// the response MyResponseProto serialized protos to batched tensors - /// using the decode_proto op. - /// - /// **NOTE** Working with serialized proto strings is faster than instantiating - /// actual proto objects in memory, so no performance degradation is expected - /// compared to writing custom kernels for this workflow. - /// - /// If the connection fails or the remote worker returns an error - /// status, the op reraises this exception locally. - /// - /// See the TryRpc op if you prefer to handle RPC failures manually in the graph. - /// - public TFOutput Rpc (TFOutput address, TFOutput method, TFOutput request, string protocol = null, bool? fail_fast = null, long? timeout_in_ms = null, string operName = null) - { - var desc = new TFOperationDesc (this, "Rpc", MakeName ("Rpc", operName)); - desc.AddInput (address); - desc.AddInput (method); - desc.AddInput (request); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - if (protocol != null) - desc.SetAttr ("protocol", protocol); - - if (fail_fast.HasValue) - desc.SetAttr ("fail_fast", fail_fast.Value); - - if (timeout_in_ms.HasValue) - desc.SetAttr ("timeout_in_ms", timeout_in_ms.Value); - - var op = desc.FinishOperation (); - int _idx = 0; - var response = new TFOutput (op, _idx++); - return response; - } - /// /// Computes reciprocal of square root of x element-wise. /// @@ -43290,16 +46723,16 @@ public TFOutput ScatterMul (TFOutput reference, TFOutput indices, TFOutput updat } /// - /// Scatter updates into a new tensor according to indices. + /// Scatters updates into a tensor of shape shape according to indices. /// /// - /// Index tensor. + /// Tensor of indices. /// /// - /// Updates to scatter into output. + /// Values to scatter into the output tensor. /// /// - /// 1-D. The shape of the resulting tensor. + /// 1-D. The shape of the output tensor. /// /// /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ScatterNd'. @@ -43310,37 +46743,41 @@ public TFOutput ScatterMul (TFOutput reference, TFOutput indices, TFOutput updat /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// /// - /// Creates a new tensor by applying sparse updates to individual values or - /// slices within a tensor (initially zero for numeric, empty for string) of - /// the given shape according to indices. This operator is the inverse of the - /// tf.gather_nd operator which extracts values or slices from a given tensor. + /// Update the input tensor by scattering sparse updates according to individual values at the specified indices. + /// This op returns an output tensor with the shape you specify. This op is the + /// inverse of the tf.gather_nd operator which extracts values or slices from a + /// given tensor. /// - /// This operation is similar to tensor_scatter_add, except that the tensor is - /// zero-initialized. Calling tf.scatter_nd(indices, values, shape) is identical - /// to tensor_scatter_add(tf.zeros(shape, values.dtype), indices, values) + /// This operation is similar to tf.tensor_scatter_add, except that the tensor is + /// zero-initialized. Calling tf.scatter_nd(indices, values, shape) + /// is identical to calling + /// tf.tensor_scatter_add(tf.zeros(shape, values.dtype), indices, values). /// - /// If indices contains duplicates, then their updates are accumulated (summed). + /// If indices contains duplicates, the duplicate values are accumulated + /// (summed). /// /// **WARNING**: The order in which updates are applied is nondeterministic, so the - /// output will be nondeterministic if indices contains duplicates -- because - /// of some numerical approximation issues, numbers summed in different order - /// may yield different results. + /// output will be nondeterministic if indices contains duplicates; + /// numbers summed in different order may yield different results because of some + /// numerical approximation issues. /// - /// indices is an integer tensor containing indices into a new tensor of shape - /// shape. The last dimension of indices can be at most the rank of shape: + /// indices is an integer tensor of shape shape. The last dimension + /// of indices can be at most the rank of shape: /// /// indices.shape[-1] &lt;= shape.rank /// - /// The last dimension of indices corresponds to indices into elements + /// The last dimension of indices corresponds to indices of elements /// (if indices.shape[-1] = shape.rank) or slices /// (if indices.shape[-1] &lt; shape.rank) along dimension indices.shape[-1] of - /// shape. updates is a tensor with shape + /// shape. + /// + /// updates is a tensor with shape: /// /// indices.shape[:-1] + shape[indices.shape[-1]:] /// - /// The simplest form of scatter is to insert individual elements in a tensor by - /// index. For example, say we want to insert 4 scattered elements in a rank-1 - /// tensor with 8 elements. + /// The simplest form of the scatter op is to insert individual elements in + /// a tensor by index. Consider an example where you want to insert 4 scattered + /// elements in a rank-1 tensor with 8 elements. /// /// &lt;div style="width:70%; margin:auto; margin-bottom:10px; margin-top:20px;"&gt; /// &lt;img style="width:100%" src="https://www.tensorflow.org/images/ScatterNd1.png" alt&gt; @@ -43360,9 +46797,9 @@ public TFOutput ScatterMul (TFOutput reference, TFOutput indices, TFOutput updat /// /// [0, 11, 0, 10, 9, 0, 0, 12] /// - /// We can also, insert entire slices of a higher rank tensor all at once. For - /// example, if we wanted to insert two slices in the first dimension of a - /// rank-3 tensor with two matrices of new values. + /// You can also insert entire slices of a higher rank tensor all at once. For + /// example, you can insert two slices in the first dimension of a rank-3 tensor + /// with two matrices of new values. /// /// &lt;div style="width:70%; margin:auto; margin-bottom:10px; margin-top:20px;"&gt; /// &lt;img style="width:100%" src="https://www.tensorflow.org/images/ScatterNd2.png" alt&gt; @@ -43487,6 +46924,98 @@ public TFOutput ScatterNdAdd (TFOutput reference, TFOutput indices, TFOutput upd return output_ref; } + /// + /// Computes element-wise maximum. + /// + /// + /// A mutable Tensor. Should be from a Variable node. + /// + /// + /// A Tensor. Must be one of the following types: int32, int64. + /// A tensor of indices into ref. + /// + /// + /// A Tensor. Must have the same type as ref. A tensor of updated values + /// to add to ref. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ScatterNdMax'. + /// + /// + /// Optional argument + /// An optional bool. Defaults to True. 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 updated values after the update is done. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + public TFOutput ScatterNdMax (TFOutput reference, TFOutput indices, TFOutput updates, bool? use_locking = null, string operName = null) + { + var desc = new TFOperationDesc (this, "ScatterNdMax", MakeName ("ScatterNdMax", operName)); + desc.AddInput (reference); + desc.AddInput (indices); + desc.AddInput (updates); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (use_locking.HasValue) + desc.SetAttr ("use_locking", use_locking.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var output_ref = new TFOutput (op, _idx++); + return output_ref; + } + + /// + /// Computes element-wise minimum. + /// + /// + /// A mutable Tensor. Should be from a Variable node. + /// + /// + /// A Tensor. Must be one of the following types: int32, int64. + /// A tensor of indices into ref. + /// + /// + /// A Tensor. Must have the same type as ref. A tensor of updated values + /// to add to ref. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ScatterNdMin'. + /// + /// + /// Optional argument + /// An optional bool. Defaults to True. 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 updated values after the update is done. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + public TFOutput ScatterNdMin (TFOutput reference, TFOutput indices, TFOutput updates, bool? use_locking = null, string operName = null) + { + var desc = new TFOperationDesc (this, "ScatterNdMin", MakeName ("ScatterNdMin", operName)); + desc.AddInput (reference); + desc.AddInput (indices); + desc.AddInput (updates); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (use_locking.HasValue) + desc.SetAttr ("use_locking", use_locking.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var output_ref = new TFOutput (op, _idx++); + return output_ref; + } + /// /// Applies sparse addition to input using individual values or slices /// @@ -44449,7 +47978,7 @@ public TFOutput SegmentProd (TFOutput data, TFOutput segment_ids, string operNam /// /// /// c = tf.constant([[1,2,3,4], [4, 3, 2, 1], [5,6,7,8]]) - /// tf.segment_sum(c, tf.constant([0, 0, 1])) + /// tf.math.segment_sum(c, tf.constant([0, 0, 1])) /// # ==&gt; [[5, 5, 5, 5], /// # [5, 6, 7, 8]] /// @@ -44693,6 +48222,55 @@ public TFOutput SeluGrad (TFOutput gradients, TFOutput outputs, string operName return backprops; } + /// + /// Sends the named tensor from send_device to recv_device. + /// + /// + /// The tensor to send. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Send'. + /// + /// + /// Optional argument + /// If set to true, this indicates that the node was added + /// to the graph as a result of a client-side feed or fetch of Tensor data, + /// in which case the corresponding send or recv is expected to be managed + /// locally by the caller. + /// + /// + /// The name of the tensor to send. + /// + /// + /// The name of the device sending the tensor. + /// + /// + /// The current incarnation of send_device. + /// + /// + /// The name of the device receiving the tensor. + /// + /// + /// Returns the description of the operation + /// + public TFOperation Send (TFOutput tensor, string tensor_name, string send_device, long send_device_incarnation, string recv_device, bool? client_terminated = null, string operName = null) + { + var desc = new TFOperationDesc (this, "Send", MakeName ("Send", operName)); + desc.AddInput (tensor); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("tensor_name", tensor_name); + desc.SetAttr ("send_device", send_device); + desc.SetAttr ("send_device_incarnation", send_device_incarnation); + desc.SetAttr ("recv_device", recv_device); + if (client_terminated.HasValue) + desc.SetAttr ("client_terminated", client_terminated.Value); + + var op = desc.FinishOperation (); + return op; + } + /// /// Performs gradient updates of embedding tables. /// @@ -44743,18 +48321,24 @@ public TFOperation SendTPUEmbeddingGradients (TFOutput[] inputs, TFOutput[] lear /// /// If specified, the created operation in the graph will be this one, otherwise it will be named 'SerializeIterator'. /// + /// + /// Optional argument + /// /// /// A variant tensor storing the state of the iterator contained in the /// resource. /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// - public TFOutput SerializeIterator (TFOutput resource_handle, string operName = null) + public TFOutput SerializeIterator (TFOutput resource_handle, long? external_state_policy = null, string operName = null) { var desc = new TFOperationDesc (this, "SerializeIterator", MakeName ("SerializeIterator", operName)); desc.AddInput (resource_handle); foreach ( TFOperation control in CurrentDependencies ) desc.AddControlInput (control); + if (external_state_policy.HasValue) + desc.SetAttr ("external_state_policy", external_state_policy.Value); + var op = desc.FinishOperation (); int _idx = 0; var serialized = new TFOutput (op, _idx++); @@ -45135,6 +48719,9 @@ public TFOutput ShardedFilespec (TFOutput basename, TFOutput num_shards, string /// /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ShuffleAndRepeatDataset'. /// + /// + /// Optional argument + /// /// /// /// @@ -45145,7 +48732,7 @@ public TFOutput ShardedFilespec (TFOutput basename, TFOutput num_shards, string /// /// pseudorandomly. /// - public TFOutput ShuffleAndRepeatDataset (TFOutput input_dataset, TFOutput buffer_size, TFOutput seed, TFOutput seed2, TFOutput count, TFDataType[] output_types, TFShape[] output_shapes, string operName = null) + public TFOutput ShuffleAndRepeatDataset (TFOutput input_dataset, TFOutput buffer_size, TFOutput seed, TFOutput seed2, TFOutput count, TFDataType[] output_types, TFShape[] output_shapes, bool? reshuffle_each_iteration = null, string operName = null) { var desc = new TFOperationDesc (this, "ShuffleAndRepeatDataset", MakeName ("ShuffleAndRepeatDataset", operName)); desc.AddInput (input_dataset); @@ -45158,6 +48745,9 @@ public TFOutput ShuffleAndRepeatDataset (TFOutput input_dataset, TFOutput buffer desc.SetAttrType ("output_types", output_types); desc.SetAttrShape ("output_shapes", output_shapes); + if (reshuffle_each_iteration.HasValue) + desc.SetAttr ("reshuffle_each_iteration", reshuffle_each_iteration.Value); + var op = desc.FinishOperation (); int _idx = 0; var handle = new TFOutput (op, _idx++); @@ -45696,6 +49286,21 @@ public TFOutput Snapshot (TFOutput input, string operName = null) /// /// Optional argument /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// /// /// /// @@ -45709,7 +49314,7 @@ public TFOutput Snapshot (TFOutput input, string operName = null) /// If not, it will run the preprocessing pipeline as usual, and write out a /// snapshot of the data processed for future use. /// - public TFOutput SnapshotDataset (TFOutput input_dataset, TFOutput path, TFDataType[] output_types, TFShape[] output_shapes, string compression = null, string reader_path_prefix = null, string writer_path_prefix = null, long? shard_size_bytes = null, long? pending_snapshot_expiry_seconds = null, long? num_reader_threads = null, long? reader_buffer_size = null, long? num_writer_threads = null, long? writer_buffer_size = null, string operName = null) + public TFOutput SnapshotDataset (TFOutput input_dataset, TFOutput path, TFDataType[] output_types, TFShape[] output_shapes, string compression = null, string reader_path_prefix = null, string writer_path_prefix = null, long? shard_size_bytes = null, long? pending_snapshot_expiry_seconds = null, long? num_reader_threads = null, long? reader_buffer_size = null, long? num_writer_threads = null, long? writer_buffer_size = null, bool? shuffle_on_read = null, long? seed = null, long? seed2 = null, string mode = null, string snapshot_name = null, string operName = null) { var desc = new TFOperationDesc (this, "SnapshotDataset", MakeName ("SnapshotDataset", operName)); desc.AddInput (input_dataset); @@ -45746,12 +49351,74 @@ public TFOutput SnapshotDataset (TFOutput input_dataset, TFOutput path, TFDataTy if (writer_buffer_size.HasValue) desc.SetAttr ("writer_buffer_size", writer_buffer_size.Value); + if (shuffle_on_read.HasValue) + desc.SetAttr ("shuffle_on_read", shuffle_on_read.Value); + + if (seed.HasValue) + desc.SetAttr ("seed", seed.Value); + + if (seed2.HasValue) + desc.SetAttr ("seed2", seed2.Value); + + if (mode != null) + desc.SetAttr ("mode", mode); + + if (snapshot_name != null) + desc.SetAttr ("snapshot_name", snapshot_name); + var op = desc.FinishOperation (); int _idx = 0; var handle = new TFOutput (op, _idx++); return handle; } + /// + /// Generates points from the Sobol sequence. + /// + /// + /// Positive scalar Tensor representing each sample's dimension. + /// + /// + /// Positive scalar Tensor of dtype int32. The number of Sobol points to return + /// in the output. + /// + /// + /// Positive scalar Tensor of dtype int32. The number of initial points of the + /// Sobol sequence to skip. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'SobolSample'. + /// + /// + /// Optional argument + /// The type of the sample. One of: float32 or float64. + /// + /// + /// Tensor of samples from Sobol sequence with shape [num_results, dim]. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Creates a Sobol sequence with num_results samples. Each sample has dimension + /// dim. Skips the first skip samples. + /// + public TFOutput SobolSample (TFOutput dim, TFOutput num_results, TFOutput skip, TFDataType? dtype = null, string operName = null) + { + var desc = new TFOperationDesc (this, "SobolSample", MakeName ("SobolSample", operName)); + desc.AddInput (dim); + desc.AddInput (num_results); + desc.AddInput (skip); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (dtype.HasValue) + desc.SetAttrType ("dtype", dtype.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var samples = new TFOutput (op, _idx++); + return samples; + } + /// /// Computes softmax activations. /// @@ -45821,30 +49488,6 @@ public TFOutput Softmax (TFOutput logits, string operName = null) return (loss, backprop); } - /// - /// Computes softplus: log(exp(features) + 1). - /// - /// - /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Softplus'. - /// - /// - /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. - /// - public TFOutput Softplus (TFOutput features, string operName = null) - { - var desc = new TFOperationDesc (this, "Softplus", MakeName ("Softplus", operName)); - desc.AddInput (features); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - var op = desc.FinishOperation (); - int _idx = 0; - var activations = new TFOutput (op, _idx++); - return activations; - } - /// /// Computes softplus gradients for a softplus operation. /// @@ -45945,6 +49588,23 @@ public TFOutput SoftsignGrad (TFOutput gradients, TFOutput features, string oper /// /// height_pad = pad_top + height + pad_bottom /// width_pad = pad_left + width + pad_right + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'SpaceToBatch'. + /// + /// + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// This is a legacy version of the more general SpaceToBatchND. + /// + /// Zero-pads and then rearranges (permutes) blocks of spatial data into batch. + /// More specifically, this op outputs a copy of the input tensor where values from + /// the height and width dimensions are moved to the batch dimension. After + /// the zero-padding, both height and width of the input must be divisible by the + /// block size. /// /// The attr block_size must be greater than one. It indicates the block size. /// @@ -46021,23 +49681,6 @@ public TFOutput SoftsignGrad (TFOutput gradients, TFOutput features, string oper /// /// Among others, this operation is useful for reducing atrous convolution into /// regular convolution. - /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'SpaceToBatch'. - /// - /// - /// - /// - /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. - /// - /// - /// This is a legacy version of the more general SpaceToBatchND. - /// - /// Zero-pads and then rearranges (permutes) blocks of spatial data into batch. - /// More specifically, this op outputs a copy of the input tensor where values from - /// the height and width dimensions are moved to the batch dimension. After - /// the zero-padding, both height and width of the input must be divisible by the - /// block size. /// public TFOutput SpaceToBatch (TFOutput input, TFOutput paddings, long block_size, string operName = null) { @@ -46069,6 +49712,22 @@ public TFOutput SpaceToBatch (TFOutput input, TFOutput paddings, long block_size /// paddings[i] = [pad_start, pad_end] specifies the padding for input dimension /// i + 1, which corresponds to spatial dimension i. It is required that /// block_shape[i] divides input_shape[i + 1] + pad_start + pad_end. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'SpaceToBatchND'. + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// This operation divides "spatial" dimensions [1, ..., M] of the input into a + /// grid of blocks of shape block_shape, and interleaves these blocks with the + /// "batch" dimension (0) such that in the output, the spatial dimensions + /// [1, ..., M] correspond to the position within the grid, and the batch + /// dimension combines both the position within a spatial block and the original + /// batch position. Prior to division into blocks, the spatial dimensions of the + /// input are optionally zero padded according to paddings. See below for a + /// precise description. /// /// This operation is equivalent to the following steps: /// @@ -46173,22 +49832,6 @@ public TFOutput SpaceToBatch (TFOutput input, TFOutput paddings, long block_size /// /// Among others, this operation is useful for reducing atrous convolution into /// regular convolution. - /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'SpaceToBatchND'. - /// - /// - /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. - /// - /// - /// This operation divides "spatial" dimensions [1, ..., M] of the input into a - /// grid of blocks of shape block_shape, and interleaves these blocks with the - /// "batch" dimension (0) such that in the output, the spatial dimensions - /// [1, ..., M] correspond to the position within the grid, and the batch - /// dimension combines both the position within a spatial block and the original - /// batch position. Prior to division into blocks, the spatial dimensions of the - /// input are optionally zero padded according to paddings. See below for a - /// precise description. /// public TFOutput SpaceToBatchND (TFOutput input, TFOutput block_shape, TFOutput paddings, string operName = null) { @@ -46927,6 +50570,9 @@ public TFOutput SparseApplyCenteredRMSProp (TFOutput var, TFOutput mg, TFOutput /// by a lock; otherwise the behavior is undefined, but may exhibit less /// contention. /// + /// + /// Optional argument + /// /// /// Same as "var". /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. @@ -46939,7 +50585,7 @@ public TFOutput SparseApplyCenteredRMSProp (TFOutput var, TFOutput mg, TFOutput /// $$var = (sign(linear) * l1 - linear) / quadratic\ if\ |linear| &gt; l1\ else\ 0.0$$ /// $$accum = accum_{new}$$ /// - public TFOutput SparseApplyFtrl (TFOutput var, TFOutput accum, TFOutput linear, TFOutput grad, TFOutput indices, TFOutput lr, TFOutput l1, TFOutput l2, TFOutput lr_power, bool? use_locking = null, string operName = null) + public TFOutput SparseApplyFtrl (TFOutput var, TFOutput accum, TFOutput linear, TFOutput grad, TFOutput indices, TFOutput lr, TFOutput l1, TFOutput l2, TFOutput lr_power, bool? use_locking = null, bool? multiply_linear_by_lr = null, string operName = null) { var desc = new TFOperationDesc (this, "SparseApplyFtrl", MakeName ("SparseApplyFtrl", operName)); desc.AddInput (var); @@ -46957,6 +50603,9 @@ public TFOutput SparseApplyFtrl (TFOutput var, TFOutput accum, TFOutput linear, if (use_locking.HasValue) desc.SetAttr ("use_locking", use_locking.Value); + if (multiply_linear_by_lr.HasValue) + desc.SetAttr ("multiply_linear_by_lr", multiply_linear_by_lr.Value); + var op = desc.FinishOperation (); int _idx = 0; var output = new TFOutput (op, _idx++); @@ -46988,7 +50637,7 @@ public TFOutput SparseApplyFtrl (TFOutput var, TFOutput accum, TFOutput linear, /// L1 regularization. Must be a scalar. /// /// - /// L2 shrinkage regulariation. Must be a scalar. + /// L2 shrinkage regularization. Must be a scalar. /// /// /// @@ -47004,6 +50653,9 @@ public TFOutput SparseApplyFtrl (TFOutput var, TFOutput accum, TFOutput linear, /// by a lock; otherwise the behavior is undefined, but may exhibit less /// contention. /// + /// + /// Optional argument + /// /// /// Same as "var". /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. @@ -47011,14 +50663,14 @@ public TFOutput SparseApplyFtrl (TFOutput var, TFOutput accum, TFOutput linear, /// /// That is for rows we have grad for, we update var, accum and linear as follows: /// grad_with_shrinkage = grad + 2 * l2_shrinkage * var - /// accum_new = accum + grad_with_shrinkage * grad_with_shrinkage - /// linear += grad_with_shrinkage + + /// accum_new = accum + grad * grad + /// 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| &gt; l1 else 0.0 /// accum = accum_new /// - public TFOutput SparseApplyFtrlV2 (TFOutput var, TFOutput accum, TFOutput linear, TFOutput grad, TFOutput indices, TFOutput lr, TFOutput l1, TFOutput l2, TFOutput l2_shrinkage, TFOutput lr_power, bool? use_locking = null, string operName = null) + public TFOutput SparseApplyFtrlV2 (TFOutput var, TFOutput accum, TFOutput linear, TFOutput grad, TFOutput indices, TFOutput lr, TFOutput l1, TFOutput l2, TFOutput l2_shrinkage, TFOutput lr_power, bool? use_locking = null, bool? multiply_linear_by_lr = null, string operName = null) { var desc = new TFOperationDesc (this, "SparseApplyFtrlV2", MakeName ("SparseApplyFtrlV2", operName)); desc.AddInput (var); @@ -47037,6 +50689,9 @@ public TFOutput SparseApplyFtrlV2 (TFOutput var, TFOutput accum, TFOutput linear if (use_locking.HasValue) desc.SetAttr ("use_locking", use_locking.Value); + if (multiply_linear_by_lr.HasValue) + desc.SetAttr ("multiply_linear_by_lr", multiply_linear_by_lr.Value); + var op = desc.FinishOperation (); int _idx = 0; var output = new TFOutput (op, _idx++); @@ -47317,6 +50972,67 @@ public TFOutput SparseApplyRMSProp (TFOutput var, TFOutput ms, TFOutput mom, TFO return output; } + /// + /// Counts the number of occurrences of each value in an integer array. + /// + /// + /// 2D int64 Tensor. + /// + /// + /// 1D int Tensor. + /// + /// + /// 1D int64 Tensor. + /// + /// + /// non-negative int scalar Tensor. + /// + /// + /// is an int32, int64, float32, or float64 Tensor with the same + /// shape as input, 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 'SparseBincount'. + /// + /// + /// Optional argument + /// bool; Whether the kernel should count the appearance or number of occurrences. + /// + /// + /// 1D Tensor with length equal to size or 2D Tensor with [batch_size, size]. + /// The counts or summed weights for each value in the range [0, size). + /// The TFOperation can be fetched from the resulting TFOutput, by fethching 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 TFOutput SparseBincount (TFOutput indices, TFOutput values, TFOutput dense_shape, TFOutput size, TFOutput weights, bool? binary_output = null, string operName = null) + { + var desc = new TFOperationDesc (this, "SparseBincount", MakeName ("SparseBincount", operName)); + desc.AddInput (indices); + desc.AddInput (values); + desc.AddInput (dense_shape); + desc.AddInput (size); + desc.AddInput (weights); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (binary_output.HasValue) + desc.SetAttr ("binary_output", binary_output.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + /// /// Concatenates a list of SparseTensor along the specified dimension. /// @@ -47464,6 +51180,71 @@ public TFOutput SparseConditionalAccumulator (TFDataType dtype, TFShape shape, s return handle; } + /// + /// Performs sparse-output bin counting for a sparse tensor input. + /// + /// + /// Tensor containing the indices of the sparse tensor to count. + /// + /// + /// Tensor containing values of the sparse tensor to count. + /// + /// + /// Tensor containing the dense shape of the sparse tensor to count. + /// + /// + /// A Tensor of the same shape as indices containing per-index weight values. + /// May also be the empty tensor if no weights are used. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'SparseCountSparseOutput'. + /// + /// + /// Optional argument + /// Minimum value to count. Can be set to -1 for no minimum. + /// + /// + /// Optional argument + /// Maximum value to count. Can be set to -1 for no maximum. + /// + /// + /// Whether to output the number of occurrences of each value or 1. + /// + /// + /// Returns a tuple with multiple values, as follows: + /// output_indices: Indices tensor for the resulting sparse tensor object. + /// output_values: Values tensor for the resulting sparse tensor object. + /// output_dense_shape: Shape tensor for the resulting sparse tensor object. + /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. + /// + /// + /// Counts the number of times each value occurs in the input. + /// + public (TFOutput output_indices, TFOutput output_values, TFOutput output_dense_shape) SparseCountSparseOutput (TFOutput indices, TFOutput values, TFOutput dense_shape, TFOutput weights, bool binary_output, long? minlength = null, long? maxlength = null, string operName = null) + { + var desc = new TFOperationDesc (this, "SparseCountSparseOutput", MakeName ("SparseCountSparseOutput", operName)); + desc.AddInput (indices); + desc.AddInput (values); + desc.AddInput (dense_shape); + desc.AddInput (weights); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("binary_output", binary_output); + if (minlength.HasValue) + desc.SetAttr ("minlength", minlength.Value); + + if (maxlength.HasValue) + desc.SetAttr ("maxlength", maxlength.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var output_indices = new TFOutput (op, _idx++); + var output_values = new TFOutput (op, _idx++); + var output_dense_shape = new TFOutput (op, _idx++); + return (output_indices, output_values, output_dense_shape); + } + /// /// Generates sparse cross from a list of sparse and dense tensors. /// @@ -47567,6 +51348,187 @@ public TFOutput SparseConditionalAccumulator (TFDataType dtype, TFShape shape, s return (output_indices, output_values, output_shape); } + /// + /// Generates sparse cross from a list of sparse and dense tensors. + /// + /// + /// 2-D. Indices of each input SparseTensor. + /// + /// + /// 1-D. values of each SparseTensor. + /// + /// + /// 1-D. Shapes of each SparseTensor. + /// + /// + /// 2-D. Columns represented by dense Tensor. + /// + /// + /// It is used if hashed_output is true. + /// output = hashed_value%num_buckets if num_buckets &gt; 0 else hashed_value. + /// + /// + /// boolean, if true, siphash with salt will be used instead of farmhash. + /// + /// + /// Specify the salt that will be used by the siphash function. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'SparseCrossHashed'. + /// + /// + /// Returns a tuple with multiple values, as follows: + /// output_indices: 2-D. Indices of the concatenated SparseTensor. + /// output_values: 1-D. Non-empty values of the concatenated or hashed + /// SparseTensor. + /// output_shape: 1-D. Shape of the concatenated SparseTensor. + /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. + /// + /// + /// The op takes two lists, one of 2D SparseTensor and one of 2D Tensor, each + /// representing features of one feature column. It outputs a 2D SparseTensor with + /// the batchwise crosses of these features. + /// + /// For example, if the inputs are + /// + /// inputs[0]: SparseTensor with shape = [2, 2] + /// [0, 0]: "a" + /// [1, 0]: "b" + /// [1, 1]: "c" + /// + /// inputs[1]: SparseTensor with shape = [2, 1] + /// [0, 0]: "d" + /// [1, 0]: "e" + /// + /// inputs[2]: Tensor [["f"], ["g"]] + /// + /// then the output will be + /// + /// shape = [2, 2] + /// [0, 0]: "a_X_d_X_f" + /// [1, 0]: "b_X_e_X_g" + /// [1, 1]: "c_X_e_X_g" + /// + /// if hashed_output=true then the output will be + /// + /// shape = [2, 2] + /// [0, 0]: FingerprintCat64( + /// Fingerprint64("f"), FingerprintCat64( + /// Fingerprint64("d"), Fingerprint64("a"))) + /// [1, 0]: FingerprintCat64( + /// Fingerprint64("g"), FingerprintCat64( + /// Fingerprint64("e"), Fingerprint64("b"))) + /// [1, 1]: FingerprintCat64( + /// Fingerprint64("g"), FingerprintCat64( + /// Fingerprint64("e"), Fingerprint64("c"))) + /// + public (TFOutput output_indices, TFOutput output_values, TFOutput output_shape) SparseCrossHashed (TFOutput[] indices, TFOutput[] values, TFOutput[] shapes, TFOutput[] dense_inputs, TFOutput num_buckets, TFOutput strong_hash, TFOutput salt, string operName = null) + { + var desc = new TFOperationDesc (this, "SparseCrossHashed", MakeName ("SparseCrossHashed", operName)); + desc.AddInputs (indices); + desc.AddInputs (values); + desc.AddInputs (shapes); + desc.AddInputs (dense_inputs); + desc.AddInput (num_buckets); + desc.AddInput (strong_hash); + desc.AddInput (salt); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var output_indices = new TFOutput (op, _idx++); + var output_values = new TFOutput (op, _idx++); + var output_shape = new TFOutput (op, _idx++); + return (output_indices, output_values, output_shape); + } + + /// + /// Generates sparse cross from a list of sparse and dense tensors. + /// + /// + /// 2-D. Indices of each input SparseTensor. + /// + /// + /// 1-D. values of each SparseTensor. + /// + /// + /// 1-D. Shapes of each SparseTensor. + /// + /// + /// 2-D. Columns represented by dense Tensor. + /// + /// + /// string used when joining a list of string inputs, can be used as separator later. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'SparseCrossV2'. + /// + /// + /// Returns a tuple with multiple values, as follows: + /// output_indices: 2-D. Indices of the concatenated SparseTensor. + /// output_values: 1-D. Non-empty values of the concatenated or hashed + /// SparseTensor. + /// output_shape: 1-D. Shape of the concatenated SparseTensor. + /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. + /// + /// + /// The op takes two lists, one of 2D SparseTensor and one of 2D Tensor, each + /// representing features of one feature column. It outputs a 2D SparseTensor with + /// the batchwise crosses of these features. + /// + /// For example, if the inputs are + /// + /// inputs[0]: SparseTensor with shape = [2, 2] + /// [0, 0]: "a" + /// [1, 0]: "b" + /// [1, 1]: "c" + /// + /// inputs[1]: SparseTensor with shape = [2, 1] + /// [0, 0]: "d" + /// [1, 0]: "e" + /// + /// inputs[2]: Tensor [["f"], ["g"]] + /// + /// then the output will be + /// + /// shape = [2, 2] + /// [0, 0]: "a_X_d_X_f" + /// [1, 0]: "b_X_e_X_g" + /// [1, 1]: "c_X_e_X_g" + /// + /// if hashed_output=true then the output will be + /// + /// shape = [2, 2] + /// [0, 0]: FingerprintCat64( + /// Fingerprint64("f"), FingerprintCat64( + /// Fingerprint64("d"), Fingerprint64("a"))) + /// [1, 0]: FingerprintCat64( + /// Fingerprint64("g"), FingerprintCat64( + /// Fingerprint64("e"), Fingerprint64("b"))) + /// [1, 1]: FingerprintCat64( + /// Fingerprint64("g"), FingerprintCat64( + /// Fingerprint64("e"), Fingerprint64("c"))) + /// + public (TFOutput output_indices, TFOutput output_values, TFOutput output_shape) SparseCrossV2 (TFOutput[] indices, TFOutput[] values, TFOutput[] shapes, TFOutput[] dense_inputs, TFOutput sep, string operName = null) + { + var desc = new TFOperationDesc (this, "SparseCrossV2", MakeName ("SparseCrossV2", operName)); + desc.AddInputs (indices); + desc.AddInputs (values); + desc.AddInputs (shapes); + desc.AddInputs (dense_inputs); + desc.AddInput (sep); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var output_indices = new TFOutput (op, _idx++); + var output_values = new TFOutput (op, _idx++); + var output_shape = new TFOutput (op, _idx++); + return (output_indices, output_values, output_shape); + } + /// /// Adds up a SparseTensor and a dense Tensor, using these special rules: /// @@ -47897,6 +51859,679 @@ public TFOutput SparseMatMul (TFOutput a, TFOutput b, bool? transpose_a = null, return product; } + /// + /// Sparse addition of two CSR matrices, C = alpha * A + beta * B. + /// + /// + /// A CSRSparseMatrix. + /// + /// + /// A CSRSparseMatrix. + /// + /// + /// A constant scalar. + /// + /// + /// A constant scalar. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'SparseMatrixAdd'. + /// + /// + /// A CSRSparseMatrix. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// The gradients of SparseMatrixAdd outputs with respect to alpha and beta are not + /// currently defined (TensorFlow will return zeros for these entries). + /// + public TFOutput SparseMatrixAdd (TFOutput a, TFOutput b, TFOutput alpha, TFOutput beta, string operName = null) + { + var desc = new TFOperationDesc (this, "SparseMatrixAdd", MakeName ("SparseMatrixAdd", operName)); + desc.AddInput (a); + desc.AddInput (b); + desc.AddInput (alpha); + desc.AddInput (beta); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var c = new TFOutput (op, _idx++); + return c; + } + + /// + /// Matrix-multiplies a sparse matrix with a dense matrix. + /// + /// + /// A CSRSparseMatrix. + /// + /// + /// A dense tensor. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'SparseMatrixMatMul'. + /// + /// + /// Optional argument + /// Indicates whether a should be transposed. + /// + /// + /// Optional argument + /// Indicates whether b should be transposed. + /// + /// + /// Optional argument + /// Indicates whether a should be conjugate-transposed. + /// + /// + /// Optional argument + /// Indicates whether b should be conjugate-transposed. + /// + /// + /// Optional argument + /// Transposes the product of a and b. + /// + /// + /// Optional argument + /// Conjugates the product of a and b. + /// + /// + /// A dense output tensor. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Returns a dense matrix. + /// For inputs A and B, where A is CSR and B is dense; this op returns a dense C; + /// + /// If transpose_output is false, returns: + /// + /// C = A . B + /// + /// + /// If transpose_output is true, returns: + /// + /// C = transpose(A . B) = transpose(B) . transpose(A) + /// + /// where the transposition is performed along the two innermost (matrix) + /// dimensions. + /// + /// If conjugate_output is true, returns: + /// + /// C = conjugate(A . B) = conjugate(A) . conjugate(B) + /// + /// + /// If both conjugate_output and transpose_output are true, returns: + /// + /// C = conjugate(transpose(A . B)) = conjugate(transpose(B)) . + /// conjugate(transpose(A)) + /// + /// + public TFOutput SparseMatrixMatMul (TFOutput a, TFOutput b, bool? transpose_a = null, bool? transpose_b = null, bool? adjoint_a = null, bool? adjoint_b = null, bool? transpose_output = null, bool? conjugate_output = null, string operName = null) + { + var desc = new TFOperationDesc (this, "SparseMatrixMatMul", MakeName ("SparseMatrixMatMul", operName)); + desc.AddInput (a); + desc.AddInput (b); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (transpose_a.HasValue) + desc.SetAttr ("transpose_a", transpose_a.Value); + + if (transpose_b.HasValue) + desc.SetAttr ("transpose_b", transpose_b.Value); + + if (adjoint_a.HasValue) + desc.SetAttr ("adjoint_a", adjoint_a.Value); + + if (adjoint_b.HasValue) + desc.SetAttr ("adjoint_b", adjoint_b.Value); + + if (transpose_output.HasValue) + desc.SetAttr ("transpose_output", transpose_output.Value); + + if (conjugate_output.HasValue) + desc.SetAttr ("conjugate_output", conjugate_output.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + + /// + /// Element-wise multiplication of a sparse matrix with a dense tensor. + /// + /// + /// A CSRSparseMatrix. + /// + /// + /// A dense tensor. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'SparseMatrixMul'. + /// + /// + /// A dense output tensor. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Returns a sparse matrix. + /// + /// The dense tensor b may be either a scalar; otherwise a must be a rank-3 + /// SparseMatrix; in this case b must be shaped [batch_size, 1, 1] and the + /// multiply operation broadcasts. + /// + /// **NOTE** even if b is zero, the sparsity structure of the output does not + /// change. + /// + public TFOutput SparseMatrixMul (TFOutput a, TFOutput b, string operName = null) + { + var desc = new TFOperationDesc (this, "SparseMatrixMul", MakeName ("SparseMatrixMul", operName)); + desc.AddInput (a); + desc.AddInput (b); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + + /// + /// Returns the number of nonzeroes of sparse_matrix. + /// + /// + /// A CSRSparseMatrix. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'SparseMatrixNNZ'. + /// + /// + /// The number of nonzeroes of sparse_matrix. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + public TFOutput SparseMatrixNNZ (TFOutput sparse_matrix, string operName = null) + { + var desc = new TFOperationDesc (this, "SparseMatrixNNZ", MakeName ("SparseMatrixNNZ", operName)); + desc.AddInput (sparse_matrix); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var nnz = new TFOutput (op, _idx++); + return nnz; + } + + /// + /// Computes the Approximate Minimum Degree (AMD) ordering of input. + /// + /// + /// A CSRSparseMatrix. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'SparseMatrixOrderingAMD'. + /// + /// + /// The Approximate Minimum Degree (AMD) ordering of input. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Computes the Approximate Minimum Degree (AMD) ordering for a sparse matrix. + /// + /// The returned permutation may be used to permute the rows and columns of the + /// given sparse matrix. This typically results in permuted sparse matrix's sparse + /// Cholesky (or other decompositions) in having fewer zero fill-in compared to + /// decomposition of the original matrix. + /// + /// The input sparse matrix may have rank 2 or rank 3. The output Tensor, + /// representing would then have rank 1 or 2 respectively, with the same batch + /// shape as the input. + /// + /// Each component of the input sparse matrix must represent a square symmetric + /// matrix; only the lower triangular part of the matrix is read. The values of the + /// sparse matrix does not affect the returned permutation, only the sparsity + /// pattern of the sparse matrix is used. Hence, a single AMD ordering may be + /// reused for the Cholesky decompositions of sparse matrices with the same sparsity + /// pattern but with possibly different values. + /// + /// Each batch component of the output permutation represents a permutation of N + /// elements, where the input sparse matrix components each have N rows. That is, + /// the component contains each of the integers {0, .. N-1} exactly once. The + /// ith element represents the row index that the ith row maps to. + /// + /// Usage example: + /// + /// + /// from tensorflow.python.ops.linalg.sparse import sparse_csr_matrix_ops + /// + /// a_indices = np.array([[0, 0], [1, 1], [2, 1], [2, 2], [3, 3]]) + /// a_values = np.array([1.0, 2.0, 1.0, 3.0, 4.0], np.float32) + /// a_dense_shape = [4, 4] + /// + /// with tf.Session() as sess: + /// # Define (COO format) SparseTensor over Numpy array. + /// a_st = tf.sparse.SparseTensor(a_indices, a_values, a_dense_shape) + /// + /// # Convert SparseTensors to CSR SparseMatrix. + /// a_sm = sparse_csr_matrix_ops.sparse_tensor_to_csr_sparse_matrix( + /// a_st.indices, a_st.values, a_st.dense_shape) + /// + /// # Obtain the AMD Ordering for the CSR SparseMatrix. + /// ordering_amd = sparse_csr_matrix_ops.sparse_matrix_ordering_amd(sparse_matrix) + /// + /// ordering_amd_value = sess.run(ordering_amd) + /// + /// + /// ordering_amd_value stores the AMD ordering: [1 2 3 0]. + /// + /// input: A CSRSparseMatrix. + /// + public TFOutput SparseMatrixOrderingAMD (TFOutput input, string operName = null) + { + var desc = new TFOperationDesc (this, "SparseMatrixOrderingAMD", MakeName ("SparseMatrixOrderingAMD", operName)); + desc.AddInput (input); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + + /// + /// Calculates the softmax of a CSRSparseMatrix. + /// + /// + /// A CSRSparseMatrix. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'SparseMatrixSoftmax'. + /// + /// + /// + /// + /// A CSRSparseMatrix. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Calculate the softmax of the innermost dimensions of a SparseMatrix. + /// + /// Missing values are treated as -inf (i.e., logits of zero probability); and + /// the output has the same sparsity structure as the input (though missing values + /// in the output may now be treated as having probability zero). + /// + public TFOutput SparseMatrixSoftmax (TFOutput logits, TFDataType type, string operName = null) + { + var desc = new TFOperationDesc (this, "SparseMatrixSoftmax", MakeName ("SparseMatrixSoftmax", operName)); + desc.AddInput (logits); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("type", type); + var op = desc.FinishOperation (); + int _idx = 0; + var softmax = new TFOutput (op, _idx++); + return softmax; + } + + /// + /// Calculates the gradient of the SparseMatrixSoftmax op. + /// + /// + /// A CSRSparseMatrix. + /// + /// + /// The gradient of softmax. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'SparseMatrixSoftmaxGrad'. + /// + /// + /// + /// + /// The output gradient. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + public TFOutput SparseMatrixSoftmaxGrad (TFOutput softmax, TFOutput grad_softmax, TFDataType type, string operName = null) + { + var desc = new TFOperationDesc (this, "SparseMatrixSoftmaxGrad", MakeName ("SparseMatrixSoftmaxGrad", operName)); + desc.AddInput (softmax); + desc.AddInput (grad_softmax); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("type", type); + var op = desc.FinishOperation (); + int _idx = 0; + var gradient = new TFOutput (op, _idx++); + return gradient; + } + + /// + /// Computes the sparse Cholesky decomposition of input. + /// + /// + /// A CSRSparseMatrix. + /// + /// + /// A fill-in reducing permutation matrix. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'SparseMatrixSparseCholesky'. + /// + /// + /// + /// + /// The sparse Cholesky decompsition of input. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Computes the Sparse Cholesky decomposition of a sparse matrix, with the given + /// fill-in reducing permutation. + /// + /// The input sparse matrix and the fill-in reducing permutation permutation must + /// have compatible shapes. If the sparse matrix has rank 3; with the batch + /// dimension B, then the permutation must be of rank 2; with the same batch + /// dimension B. There is no support for broadcasting. + /// + /// Furthermore, each component vector of permutation must be of length N, + /// containing each of the integers {0, 1, ..., N - 1} exactly once, where N is + /// the number of rows of each component of the sparse matrix. + /// + /// Each component of the input sparse matrix must represent a symmetric positive + /// definite (SPD) matrix; although only the lower triangular part of the matrix is + /// read. If any individual component is not SPD, then an InvalidArgument error is + /// thrown. + /// + /// The returned sparse matrix has the same dense shape as the input sparse matrix. + /// For each component A of the input sparse matrix, the corresponding output + /// sparse matrix represents L, the lower triangular Cholesky factor satisfying + /// the following identity: + /// + /// + /// A = L * Lt + /// + /// + /// where Lt denotes the transpose of L (or its conjugate transpose, if type is + /// complex64 or complex128). + /// + /// The type parameter denotes the type of the matrix elements. The supported + /// types are: float32, float64, complex64 and complex128. + /// + /// Usage example: + /// + /// + /// from tensorflow.python.ops.linalg.sparse import sparse_csr_matrix_ops + /// + /// a_indices = np.array([[0, 0], [1, 1], [2, 1], [2, 2], [3, 3]]) + /// a_values = np.array([1.0, 2.0, 1.0, 3.0, 4.0], np.float32) + /// a_dense_shape = [4, 4] + /// + /// with tf.Session() as sess: + /// # Define (COO format) SparseTensor over Numpy array. + /// a_st = tf.sparse.SparseTensor(a_indices, a_values, a_dense_shape) + /// + /// # Convert SparseTensors to CSR SparseMatrix. + /// a_sm = sparse_csr_matrix_ops.sparse_tensor_to_csr_sparse_matrix( + /// a_st.indices, a_st.values, a_st.dense_shape) + /// + /// # Obtain the Sparse Cholesky factor using AMD Ordering for reducing zero + /// # fill-in (number of structural non-zeros in the sparse Cholesky factor). + /// ordering_amd = sparse_csr_matrix_ops.sparse_matrix_ordering_amd(sparse_matrix) + /// cholesky_sparse_matrices = ( + /// sparse_csr_matrix_ops.sparse_matrix_sparse_cholesky( + /// sparse_matrix, ordering_amd, type=tf.float32)) + /// + /// # Convert the CSRSparseMatrix Cholesky factor to a dense Tensor + /// dense_cholesky = sparse_csr_matrix_ops.csr_sparse_matrix_to_dense( + /// cholesky_sparse_matrices, tf.float32) + /// + /// # Evaluate the dense Tensor value. + /// dense_cholesky_value = sess.run(dense_cholesky) + /// + /// + /// dense_cholesky_value stores the dense Cholesky factor: + /// + /// + /// [[ 1. 0. 0. 0.] + /// [ 0. 1.41 0. 0.] + /// [ 0. 0.70 1.58 0.] + /// [ 0. 0. 0. 2.]] + /// + /// + /// + /// input: A CSRSparseMatrix. + /// permutation: A Tensor. + /// type: The type of input. + /// + public TFOutput SparseMatrixSparseCholesky (TFOutput input, TFOutput permutation, TFDataType type, string operName = null) + { + var desc = new TFOperationDesc (this, "SparseMatrixSparseCholesky", MakeName ("SparseMatrixSparseCholesky", operName)); + desc.AddInput (input); + desc.AddInput (permutation); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("type", type); + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + + /// + /// Sparse-matrix-multiplies two CSR matrices a and b. + /// + /// + /// A CSRSparseMatrix. + /// + /// + /// A CSRSparseMatrix. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'SparseMatrixSparseMatMul'. + /// + /// + /// Optional argument + /// Indicates whether a should be transposed. + /// + /// + /// Optional argument + /// Indicates whether b should be transposed. + /// + /// + /// Optional argument + /// Indicates whether a should be conjugate-transposed. + /// + /// + /// Optional argument + /// Indicates whether b should be conjugate-transposed. + /// + /// + /// + /// + /// A CSRSparseMatrix. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Performs a matrix multiplication of a sparse matrix a with a sparse matrix + /// b; returns a sparse matrix a * b, unless either a or b is transposed or + /// adjointed. + /// + /// Each matrix may be transposed or adjointed (conjugated and transposed) + /// according to the Boolean parameters transpose_a, adjoint_a, transpose_b + /// and adjoint_b. At most one of transpose_a or adjoint_a may be True. + /// Similarly, at most one of transpose_b or adjoint_b may be True. + /// + /// The inputs must have compatible shapes. That is, the inner dimension of a + /// must be equal to the outer dimension of b. This requirement is adjusted + /// according to whether either a or b is transposed or adjointed. + /// + /// The type parameter denotes the type of the matrix elements. Both a and b + /// must have the same type. The supported types are: float32, float64, + /// complex64 and complex128. + /// + /// Both a and b must have the same rank. Broadcasting is not supported. If they + /// have rank 3, each batch of 2D CSRSparseMatrices within a and b must have the + /// same dense shape. + /// + /// The sparse matrix product may have numeric (non-structural) zeros. + /// TODO(anudhyan): Consider adding a boolean attribute to control whether to prune + /// zeros. + /// + /// Usage example: + /// + /// + /// from tensorflow.python.ops.linalg.sparse import sparse_csr_matrix_ops + /// + /// a_indices = np.array([[0, 0], [2, 3], [2, 4], [3, 0]]) + /// a_values = np.array([1.0, 5.0, -1.0, -2.0], np.float32) + /// a_dense_shape = [4, 5] + /// + /// b_indices = np.array([[0, 0], [3, 0], [3, 1]]) + /// b_values = np.array([2.0, 7.0, 8.0], np.float32) + /// b_dense_shape = [5, 3] + /// + /// with tf.Session() as sess: + /// # Define (COO format) Sparse Tensors over Numpy arrays + /// a_st = tf.sparse.SparseTensor(a_indices, a_values, a_dense_shape) + /// b_st = tf.sparse.SparseTensor(b_indices, b_values, b_dense_shape) + /// + /// # Convert SparseTensors to CSR SparseMatrix + /// a_sm = sparse_csr_matrix_ops.sparse_tensor_to_csr_sparse_matrix( + /// a_st.indices, a_st.values, a_st.dense_shape) + /// b_sm = sparse_csr_matrix_ops.sparse_tensor_to_csr_sparse_matrix( + /// b_st.indices, b_st.values, b_st.dense_shape) + /// + /// # Compute the CSR SparseMatrix matrix multiplication + /// c_sm = sparse_csr_matrix_ops.sparse_matrix_sparse_mat_mul( + /// a=a_sm, b=b_sm, type=tf.float32) + /// + /// # Convert the CSR SparseMatrix product to a dense Tensor + /// c_sm_dense = sparse_csr_matrix_ops.csr_sparse_matrix_to_dense( + /// c_sm, tf.float32) + /// # Evaluate the dense Tensor value + /// c_sm_dense_value = sess.run(c_sm_dense) + /// + /// + /// c_sm_dense_value stores the dense matrix product: + /// + /// + /// [[ 2. 0. 0.] + /// [ 0. 0. 0.] + /// [ 35. 40. 0.] + /// [ -4. 0. 0.]] + /// + /// + /// a: A CSRSparseMatrix. + /// b: A CSRSparseMatrix with the same type and rank as a. + /// type: The type of both a and b. + /// transpose_a: If True, a transposed before multiplication. + /// transpose_b: If True, b transposed before multiplication. + /// adjoint_a: If True, a adjointed before multiplication. + /// adjoint_b: If True, b adjointed before multiplication. + /// + public TFOutput SparseMatrixSparseMatMul (TFOutput a, TFOutput b, TFDataType type, bool? transpose_a = null, bool? transpose_b = null, bool? adjoint_a = null, bool? adjoint_b = null, string operName = null) + { + var desc = new TFOperationDesc (this, "SparseMatrixSparseMatMul", MakeName ("SparseMatrixSparseMatMul", operName)); + desc.AddInput (a); + desc.AddInput (b); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("type", type); + if (transpose_a.HasValue) + desc.SetAttr ("transpose_a", transpose_a.Value); + + if (transpose_b.HasValue) + desc.SetAttr ("transpose_b", transpose_b.Value); + + if (adjoint_a.HasValue) + desc.SetAttr ("adjoint_a", adjoint_a.Value); + + if (adjoint_b.HasValue) + desc.SetAttr ("adjoint_b", adjoint_b.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var c = new TFOutput (op, _idx++); + return c; + } + + /// + /// Transposes the inner (matrix) dimensions of a CSRSparseMatrix. + /// + /// + /// A CSRSparseMatrix. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'SparseMatrixTranspose'. + /// + /// + /// Optional argument + /// Indicates whether input should be conjugated. + /// + /// + /// + /// + /// A CSRSparseMatrix. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Transposes the inner (matrix) dimensions of a SparseMatrix and optionally + /// conjugates its values. + /// + public TFOutput SparseMatrixTranspose (TFOutput input, TFDataType type, bool? conjugate = null, string operName = null) + { + var desc = new TFOperationDesc (this, "SparseMatrixTranspose", MakeName ("SparseMatrixTranspose", operName)); + desc.AddInput (input); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("type", type); + if (conjugate.HasValue) + desc.SetAttr ("conjugate", conjugate.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + + /// + /// Creates an all-zeros CSRSparseMatrix with shape dense_shape. + /// + /// + /// The desired matrix shape. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'SparseMatrixZeros'. + /// + /// + /// + /// + /// An empty CSR matrix with shape dense_shape. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + public TFOutput SparseMatrixZeros (TFOutput dense_shape, TFDataType type, string operName = null) + { + var desc = new TFOperationDesc (this, "SparseMatrixZeros", MakeName ("SparseMatrixZeros", operName)); + desc.AddInput (dense_shape); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("type", type); + var op = desc.FinishOperation (); + int _idx = 0; + var sparse_matrix = new TFOutput (op, _idx++); + return sparse_matrix; + } + /// /// Computes the max of elements across dimensions of a SparseTensor. /// @@ -48359,7 +52994,7 @@ public TFOutput SparseSegmentMeanGrad (TFOutput grad, TFOutput indices, TFOutput /// /// /// Like SparseSegmentMean, but allows missing ids in segment_ids. If an id is - /// misisng, the output tensor at that position will be zeroed. + /// missing, the output tensor at that position will be zeroed. /// /// Read /// [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) @@ -48488,7 +53123,7 @@ public TFOutput SparseSegmentSqrtNGrad (TFOutput grad, TFOutput indices, TFOutpu /// N is the size of the segment being reduced. /// /// Like SparseSegmentSqrtN, but allows missing ids in segment_ids. If an id is - /// misisng, the output tensor at that position will be zeroed. + /// missing, the output tensor at that position will be zeroed. /// /// Read /// [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) @@ -48575,6 +53210,47 @@ public TFOutput SparseSegmentSum (TFOutput data, TFOutput indices, TFOutput segm return output; } + /// + /// Computes gradients for SparseSegmentSum. + /// + /// + /// gradient propagated to the SparseSegmentSum op. + /// + /// + /// indices passed to the corresponding SparseSegmentSum op. + /// + /// + /// segment_ids passed to the corresponding SparseSegmentSum op. + /// + /// + /// dimension 0 of "data" passed to SparseSegmentSum op. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'SparseSegmentSumGrad'. + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Returns tensor "output" with same shape as grad, except for dimension 0 whose + /// value is output_dim0. + /// + public TFOutput SparseSegmentSumGrad (TFOutput grad, TFOutput indices, TFOutput segment_ids, TFOutput output_dim0, string operName = null) + { + var desc = new TFOperationDesc (this, "SparseSegmentSumGrad", MakeName ("SparseSegmentSumGrad", operName)); + desc.AddInput (grad); + desc.AddInput (indices); + desc.AddInput (segment_ids); + desc.AddInput (output_dim0); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + /// /// Computes the sum along sparse segments of a tensor. /// @@ -48599,7 +53275,7 @@ public TFOutput SparseSegmentSum (TFOutput data, TFOutput indices, TFOutput segm /// /// /// Like SparseSegmentSum, but allows missing ids in segment_ids. If an id is - /// misisng, the output tensor at that position will be zeroed. + /// missing, the output tensor at that position will be zeroed. /// /// Read /// [the section on segmentation](https://tensorflow.org/api_docs/python/tf/sparse#Segmentation) @@ -49172,6 +53848,40 @@ public TFOutput SparseTensorSliceDataset (TFOutput indices, TFOutput values, TFO return handle; } + /// + /// Converts a SparseTensor to a (possibly batched) CSRSparseMatrix. + /// + /// + /// SparseTensor indices. + /// + /// + /// SparseTensor values. + /// + /// + /// SparseTensor dense shape. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'SparseTensorToCSRSparseMatrix'. + /// + /// + /// A (possibly batched) CSRSparseMatrix. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + public TFOutput SparseTensorToCSRSparseMatrix (TFOutput indices, TFOutput values, TFOutput dense_shape, string operName = null) + { + var desc = new TFOperationDesc (this, "SparseTensorToCSRSparseMatrix", MakeName ("SparseTensorToCSRSparseMatrix", operName)); + desc.AddInput (indices); + desc.AddInput (values); + desc.AddInput (dense_shape); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var sparse_matrix = new TFOutput (op, _idx++); + return sparse_matrix; + } + /// /// Converts a sparse representation into a dense tensor. /// @@ -49552,7 +54262,7 @@ public TFOutput Square (TFOutput x, string operName = null) } /// - /// Returns (x - y)(x - y) element-wise. + /// Returns conj(x - y)(x - y) element-wise. /// /// /// @@ -50405,6 +55115,189 @@ public TFOutput StatelessMultinomial (TFOutput logits, TFOutput num_samples, TFO return output; } + /// + /// Outputs deterministic pseudorandom random numbers from a binomial distribution. + /// + /// + /// The shape of the output tensor. + /// + /// + /// 2 seeds (shape [2]). + /// + /// + /// The counts of the binomial distribution. Must be broadcastable with probs, + /// and broadcastable with the rightmost dimensions of shape. + /// + /// + /// The probability of success for the binomial distribution. Must be broadcastable + /// with counts and broadcastable with the rightmost dimensions of shape. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'StatelessRandomBinomial'. + /// + /// + /// Optional argument + /// The type of the output. + /// + /// + /// Random values with specified shape. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Outputs random values from a binomial distribution. + /// + /// The outputs are a deterministic function of shape, seed, counts, and probs. + /// + public TFOutput StatelessRandomBinomial (TFOutput shape, TFOutput seed, TFOutput counts, TFOutput probs, TFDataType? dtype = null, string operName = null) + { + var desc = new TFOperationDesc (this, "StatelessRandomBinomial", MakeName ("StatelessRandomBinomial", operName)); + desc.AddInput (shape); + desc.AddInput (seed); + desc.AddInput (counts); + desc.AddInput (probs); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (dtype.HasValue) + desc.SetAttrType ("dtype", dtype.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + + /// + /// Outputs deterministic pseudorandom random numbers from a gamma distribution. + /// + /// + /// The shape of the output tensor. + /// + /// + /// 2 seeds (shape [2]). + /// + /// + /// The concentration of the gamma distribution. Shape must match the rightmost + /// dimensions of shape. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'StatelessRandomGammaV2'. + /// + /// + /// Random values with specified shape. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Outputs random values from a gamma distribution. + /// + /// The outputs are a deterministic function of shape, seed, and alpha. + /// + public TFOutput StatelessRandomGammaV2 (TFOutput shape, TFOutput seed, TFOutput alpha, string operName = null) + { + var desc = new TFOperationDesc (this, "StatelessRandomGammaV2", MakeName ("StatelessRandomGammaV2", operName)); + desc.AddInput (shape); + desc.AddInput (seed); + desc.AddInput (alpha); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + + /// + /// Picks the best counter-based RNG algorithm based on device. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'StatelessRandomGetAlg'. + /// + /// + /// The RNG algorithm (shape int32[]). + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// This op picks the best counter-based RNG algorithm based on device. + /// + public TFOutput StatelessRandomGetAlg (string operName = null) + { + var desc = new TFOperationDesc (this, "StatelessRandomGetAlg", MakeName ("StatelessRandomGetAlg", operName)); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var alg = new TFOutput (op, _idx++); + return alg; + } + + /// + /// Scrambles seed into key and counter, using the best algorithm based on device. + /// + /// + /// 2 seeds (shape [2]). + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'StatelessRandomGetKeyCounter'. + /// + /// + /// Returns a tuple with multiple values, as follows: + /// key: Key for the counter-based RNG algorithm (shape uint64[1]). + /// counter: Counter for the counter-based RNG algorithm. Since counter size is algorithm-dependent, this output will be right-padded with zeros to reach shape uint64[2] (the current maximal counter size among algorithms). + /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. + /// + /// + /// This op scrambles a shape-[2] seed into a key and a counter, both needed by counter-based RNG algorithms. The scrambing uses the best algorithm based on device. The scrambling is opaque but approximately satisfies the property that different seed results in different key/counter pair (which will in turn result in different random numbers). + /// + public (TFOutput key, TFOutput counter) StatelessRandomGetKeyCounter (TFOutput seed, string operName = null) + { + var desc = new TFOperationDesc (this, "StatelessRandomGetKeyCounter", MakeName ("StatelessRandomGetKeyCounter", operName)); + desc.AddInput (seed); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var key = new TFOutput (op, _idx++); + var counter = new TFOutput (op, _idx++); + return (key, counter); + } + + /// + /// Picks the best algorithm based on device, and scrambles seed into key and counter. + /// + /// + /// 2 seeds (shape [2]). + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'StatelessRandomGetKeyCounterAlg'. + /// + /// + /// Returns a tuple with multiple values, as follows: + /// key: Key for the counter-based RNG algorithm (shape uint64[1]). + /// counter: Counter for the counter-based RNG algorithm. Since counter size is algorithm-dependent, this output will be right-padded with zeros to reach shape uint64[2] (the current maximal counter size among algorithms). + /// alg: The RNG algorithm (shape int32[]). + /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. + /// + /// + /// This op picks the best counter-based RNG algorithm based on device, and scrambles a shape-[2] seed into a key and a counter, both needed by the counter-based algorithm. The scrambling is opaque but approximately satisfies the property that different seed results in different key/counter pair (which will in turn result in different random numbers). + /// + public (TFOutput key, TFOutput counter, TFOutput alg) StatelessRandomGetKeyCounterAlg (TFOutput seed, string operName = null) + { + var desc = new TFOperationDesc (this, "StatelessRandomGetKeyCounterAlg", MakeName ("StatelessRandomGetKeyCounterAlg", operName)); + desc.AddInput (seed); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var key = new TFOutput (op, _idx++); + var counter = new TFOutput (op, _idx++); + var alg = new TFOutput (op, _idx++); + return (key, counter, alg); + } + /// /// Outputs deterministic pseudorandom values from a normal distribution. /// @@ -50447,6 +55340,100 @@ public TFOutput StatelessRandomNormal (TFOutput shape, TFOutput seed, TFDataType return output; } + /// + /// Outputs deterministic pseudorandom values from a normal distribution. + /// + /// + /// The shape of the output tensor. + /// + /// + /// Key for the counter-based RNG algorithm (shape uint64[1]). + /// + /// + /// Initial counter for the counter-based RNG algorithm (shape uint64[2] or uint64[1] depending on the algorithm). If a larger vector is given, only the needed portion on the left (i.e. [:N]) will be used. + /// + /// + /// The RNG algorithm (shape int32[]). + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'StatelessRandomNormalV2'. + /// + /// + /// Optional argument + /// The type of the output. + /// + /// + /// Random values with specified shape. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// The generated values will have mean 0 and standard deviation 1. + /// + /// The outputs are a deterministic function of shape, key, counter and alg. + /// + public TFOutput StatelessRandomNormalV2 (TFOutput shape, TFOutput key, TFOutput counter, TFOutput alg, TFDataType? dtype = null, string operName = null) + { + var desc = new TFOperationDesc (this, "StatelessRandomNormalV2", MakeName ("StatelessRandomNormalV2", operName)); + desc.AddInput (shape); + desc.AddInput (key); + desc.AddInput (counter); + desc.AddInput (alg); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (dtype.HasValue) + desc.SetAttrType ("dtype", dtype.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + + /// + /// Outputs deterministic pseudorandom random numbers from a Poisson distribution. + /// + /// + /// The shape of the output tensor. + /// + /// + /// 2 seeds (shape [2]). + /// + /// + /// The rate of the Poisson distribution. Shape must match the rightmost dimensions + /// of shape. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'StatelessRandomPoisson'. + /// + /// + /// The type of the output. + /// + /// + /// Random values with specified shape. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Outputs random values from a Poisson distribution. + /// + /// The outputs are a deterministic function of shape, seed, and lam. + /// + public TFOutput StatelessRandomPoisson (TFOutput shape, TFOutput seed, TFOutput lam, TFDataType dtype, string operName = null) + { + var desc = new TFOperationDesc (this, "StatelessRandomPoisson", MakeName ("StatelessRandomPoisson", operName)); + desc.AddInput (shape); + desc.AddInput (seed); + desc.AddInput (lam); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("dtype", dtype); + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + /// /// Outputs deterministic pseudorandom random values from a uniform distribution. /// @@ -50490,6 +55477,98 @@ public TFOutput StatelessRandomUniform (TFOutput shape, TFOutput seed, TFDataTyp return output; } + /// + /// Outputs deterministic pseudorandom random integers from a uniform distribution. + /// + /// + /// The shape of the output tensor. + /// + /// + /// 2 seeds (shape [2]). + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'StatelessRandomUniformFullInt'. + /// + /// + /// Optional argument + /// The type of the output. + /// + /// + /// Random values with specified shape. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// The generated values are uniform integers covering the whole range of dtype. + /// + /// The outputs are a deterministic function of shape and seed. + /// + public TFOutput StatelessRandomUniformFullInt (TFOutput shape, TFOutput seed, TFDataType? dtype = null, string operName = null) + { + var desc = new TFOperationDesc (this, "StatelessRandomUniformFullInt", MakeName ("StatelessRandomUniformFullInt", operName)); + desc.AddInput (shape); + desc.AddInput (seed); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (dtype.HasValue) + desc.SetAttrType ("dtype", dtype.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + + /// + /// Outputs deterministic pseudorandom random integers from a uniform distribution. + /// + /// + /// The shape of the output tensor. + /// + /// + /// Key for the counter-based RNG algorithm (shape uint64[1]). + /// + /// + /// Initial counter for the counter-based RNG algorithm (shape uint64[2] or uint64[1] depending on the algorithm). If a larger vector is given, only the needed portion on the left (i.e. [:N]) will be used. + /// + /// + /// The RNG algorithm (shape int32[]). + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'StatelessRandomUniformFullIntV2'. + /// + /// + /// Optional argument + /// The type of the output. + /// + /// + /// Random values with specified shape. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// The generated values are uniform integers covering the whole range of dtype. + /// + /// The outputs are a deterministic function of shape, key, counter and alg. + /// + public TFOutput StatelessRandomUniformFullIntV2 (TFOutput shape, TFOutput key, TFOutput counter, TFOutput alg, TFDataType? dtype = null, string operName = null) + { + var desc = new TFOperationDesc (this, "StatelessRandomUniformFullIntV2", MakeName ("StatelessRandomUniformFullIntV2", operName)); + desc.AddInput (shape); + desc.AddInput (key); + desc.AddInput (counter); + desc.AddInput (alg); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (dtype.HasValue) + desc.SetAttrType ("dtype", dtype.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + /// /// Outputs deterministic pseudorandom random integers from a uniform distribution. /// @@ -50533,6 +55612,253 @@ public TFOutput StatelessRandomUniformInt (TFOutput shape, TFOutput seed, TFOutp return output; } + /// + /// Outputs deterministic pseudorandom random integers from a uniform distribution. + /// + /// + /// The shape of the output tensor. + /// + /// + /// Key for the counter-based RNG algorithm (shape uint64[1]). + /// + /// + /// Initial counter for the counter-based RNG algorithm (shape uint64[2] or uint64[1] depending on the algorithm). If a larger vector is given, only the needed portion on the left (i.e. [:N]) will be used. + /// + /// + /// The RNG algorithm (shape int32[]). + /// + /// + /// Minimum value (inclusive, scalar). + /// + /// + /// Maximum value (exclusive, scalar). + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'StatelessRandomUniformIntV2'. + /// + /// + /// Random values with specified shape. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// The generated values follow a uniform distribution in the range [minval, maxval). + /// + /// The outputs are a deterministic function of shape, key, counter, alg, minval and maxval. + /// + public TFOutput StatelessRandomUniformIntV2 (TFOutput shape, TFOutput key, TFOutput counter, TFOutput alg, TFOutput minval, TFOutput maxval, string operName = null) + { + var desc = new TFOperationDesc (this, "StatelessRandomUniformIntV2", MakeName ("StatelessRandomUniformIntV2", operName)); + desc.AddInput (shape); + desc.AddInput (key); + desc.AddInput (counter); + desc.AddInput (alg); + desc.AddInput (minval); + desc.AddInput (maxval); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + + /// + /// Outputs deterministic pseudorandom random values from a uniform distribution. + /// + /// + /// The shape of the output tensor. + /// + /// + /// Key for the counter-based RNG algorithm (shape uint64[1]). + /// + /// + /// Initial counter for the counter-based RNG algorithm (shape uint64[2] or uint64[1] depending on the algorithm). If a larger vector is given, only the needed portion on the left (i.e. [:N]) will be used. + /// + /// + /// The RNG algorithm (shape int32[]). + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'StatelessRandomUniformV2'. + /// + /// + /// Optional argument + /// The type of the output. + /// + /// + /// Random values with specified shape. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// The generated values follow a uniform distribution in the range [0, 1). The + /// lower bound 0 is included in the range, while the upper bound 1 is excluded. + /// + /// The outputs are a deterministic function of shape, key, counter and alg. + /// + public TFOutput StatelessRandomUniformV2 (TFOutput shape, TFOutput key, TFOutput counter, TFOutput alg, TFDataType? dtype = null, string operName = null) + { + var desc = new TFOperationDesc (this, "StatelessRandomUniformV2", MakeName ("StatelessRandomUniformV2", operName)); + desc.AddInput (shape); + desc.AddInput (key); + desc.AddInput (counter); + desc.AddInput (alg); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (dtype.HasValue) + desc.SetAttrType ("dtype", dtype.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + + /// + /// Generate a randomly distorted bounding box for an image deterministically. + /// + /// + /// 1-D, containing [height, width, channels]. + /// + /// + /// 3-D with shape [batch, N, 4] describing the N bounding boxes + /// associated with the image. + /// + /// + /// The cropped area of the image must contain at least this + /// fraction of any bounding box supplied. The value of this parameter should be + /// non-negative. In the case of 0, the cropped area does not need to overlap + /// any of the bounding boxes supplied. + /// + /// + /// 1-D with shape [2]. The seed to the random number generator. Must have dtype + /// int32 or int64. (When using XLA, only int32 is allowed.) + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'StatelessSampleDistortedBoundingBox'. + /// + /// + /// Optional argument + /// The cropped area of the image must have an aspect ratio = + /// width / height within this range. + /// + /// + /// Optional argument + /// The cropped area of the image must contain a fraction of the + /// supplied image within this range. + /// + /// + /// Optional argument + /// Number of attempts at generating a cropped region of the image + /// of the specified constraints. After max_attempts failures, return the entire + /// image. + /// + /// + /// Optional argument + /// Controls behavior if no bounding boxes supplied. + /// If true, assume an implicit bounding box covering the whole input. If false, + /// raise an error. + /// + /// + /// Returns a tuple with multiple values, as follows: + /// begin: 1-D, containing [offset_height, offset_width, 0]. Provide as input to + /// tf.slice. + /// size: 1-D, containing [target_height, target_width, -1]. Provide as input to + /// tf.slice. + /// bboxes: 3-D with shape [1, 1, 4] containing the distorted bounding box. + /// Provide as input to tf.image.draw_bounding_boxes. + /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. + /// + /// + /// Bounding box annotations are often supplied in addition to ground-truth labels + /// in image recognition or object localization tasks. A common technique for + /// training such a system is to randomly distort an image while preserving its + /// content, i.e. *data augmentation*. This Op, given the same seed, + /// deterministically outputs a randomly distorted localization of an object, i.e. + /// bounding box, given an image_size, bounding_boxes and a series of + /// constraints. + /// + /// The output of this Op is a single bounding box that may be used to crop the + /// original image. The output is returned as 3 tensors: begin, size and + /// bboxes. The first 2 tensors can be fed directly into tf.slice to crop the + /// image. The latter may be supplied to tf.image.draw_bounding_boxes to visualize + /// what the bounding box looks like. + /// + /// Bounding boxes are supplied and returned 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 + /// the height of the underlying image. + /// + /// The output of this Op is guaranteed to be the same given the same seed and is + /// independent of how many times the function is called, and independent of global + /// seed settings (e.g. tf.random.set_seed). + /// + /// Example usage: + /// + /// &gt;&gt;&gt; image = np.array([[[1], [2], [3]], [[4], [5], [6]], [[7], [8], [9]]]) + /// &gt;&gt;&gt; bbox = tf.constant( + /// ... [0.0, 0.0, 1.0, 1.0], dtype=tf.float32, shape=[1, 1, 4]) + /// &gt;&gt;&gt; seed = (1, 2) + /// &gt;&gt;&gt; # Generate a single distorted bounding box. + /// &gt;&gt;&gt; bbox_begin, bbox_size, bbox_draw = ( + /// ... tf.image.stateless_sample_distorted_bounding_box( + /// ... tf.shape(image), bounding_boxes=bbox, seed=seed)) + /// &gt;&gt;&gt; # Employ the bounding box to distort the image. + /// &gt;&gt;&gt; tf.slice(image, bbox_begin, bbox_size) + /// &lt;tf.Tensor: shape=(2, 2, 1), dtype=int64, numpy= + /// array([[[1], + /// [2]], + /// [[4], + /// [5]]])&gt; + /// &gt;&gt;&gt; # Draw the bounding box in an image summary. + /// &gt;&gt;&gt; colors = np.array([[1.0, 0.0, 0.0], [0.0, 0.0, 1.0]]) + /// &gt;&gt;&gt; tf.image.draw_bounding_boxes( + /// ... tf.expand_dims(tf.cast(image, tf.float32),0), bbox_draw, colors) + /// &lt;tf.Tensor: shape=(1, 3, 3, 1), dtype=float32, numpy= + /// array([[[[1.], + /// [1.], + /// [3.]], + /// [[1.], + /// [1.], + /// [6.]], + /// [[7.], + /// [8.], + /// [9.]]]], dtype=float32)&gt; + /// + /// Note that if no bounding box information is available, setting + /// use_image_if_no_bounding_boxes = true will assume there is a single implicit + /// bounding box covering the whole image. If use_image_if_no_bounding_boxes is + /// false and no bounding boxes are supplied, an error is raised. + /// + public (TFOutput begin, TFOutput size, TFOutput bboxes) StatelessSampleDistortedBoundingBox (TFOutput image_size, TFOutput bounding_boxes, TFOutput min_object_covered, TFOutput seed, float[] aspect_ratio_range = null, float[] area_range = null, long? max_attempts = null, bool? use_image_if_no_bounding_boxes = null, string operName = null) + { + var desc = new TFOperationDesc (this, "StatelessSampleDistortedBoundingBox", MakeName ("StatelessSampleDistortedBoundingBox", operName)); + desc.AddInput (image_size); + desc.AddInput (bounding_boxes); + desc.AddInput (min_object_covered); + desc.AddInput (seed); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (aspect_ratio_range != null) + desc.SetAttr ("aspect_ratio_range", aspect_ratio_range); + + if (area_range != null) + desc.SetAttr ("area_range", area_range); + + if (max_attempts.HasValue) + desc.SetAttr ("max_attempts", max_attempts.Value); + + if (use_image_if_no_bounding_boxes.HasValue) + desc.SetAttr ("use_image_if_no_bounding_boxes", use_image_if_no_bounding_boxes.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var begin = new TFOutput (op, _idx++); + var size = new TFOutput (op, _idx++); + var bboxes = new TFOutput (op, _idx++); + return (begin, size, bboxes); + } + /// /// Outputs deterministic pseudorandom values from a truncated normal distribution. /// @@ -50577,6 +55903,58 @@ public TFOutput StatelessTruncatedNormal (TFOutput shape, TFOutput seed, TFDataT return output; } + /// + /// Outputs deterministic pseudorandom values from a truncated normal distribution. + /// + /// + /// The shape of the output tensor. + /// + /// + /// Key for the counter-based RNG algorithm (shape uint64[1]). + /// + /// + /// Initial counter for the counter-based RNG algorithm (shape uint64[2] or uint64[1] depending on the algorithm). If a larger vector is given, only the needed portion on the left (i.e. [:N]) will be used. + /// + /// + /// The RNG algorithm (shape int32[]). + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'StatelessTruncatedNormalV2'. + /// + /// + /// Optional argument + /// The type of the output. + /// + /// + /// Random values with specified shape. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// The generated values follow a normal distribution with mean 0 and standard + /// deviation 1, except that values whose magnitude is more than 2 standard + /// deviations from the mean are dropped and re-picked. + /// + /// The outputs are a deterministic function of shape, key, counter and alg. + /// + public TFOutput StatelessTruncatedNormalV2 (TFOutput shape, TFOutput key, TFOutput counter, TFOutput alg, TFDataType? dtype = null, string operName = null) + { + var desc = new TFOperationDesc (this, "StatelessTruncatedNormalV2", MakeName ("StatelessTruncatedNormalV2", operName)); + desc.AddInput (shape); + desc.AddInput (key); + desc.AddInput (counter); + desc.AddInput (alg); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (dtype.HasValue) + desc.SetAttrType ("dtype", dtype.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + /// /// Check if the input matches the regex pattern. /// @@ -50764,7 +56142,45 @@ public TFOutput StatsAggregatorSummary (TFOutput iterator, string operName = nul /// taken into account for computing gradients. /// /// This is useful any time you want to compute a value with TensorFlow but need - /// to pretend that the value was a constant. Some examples include: + /// to pretend that the value was a constant. For example, the softmax function + /// for a vector x can be written as + /// + /// + /// + /// def softmax(x): + /// numerator = tf.exp(x) + /// denominator = tf.reduce_sum(numerator) + /// return numerator / denominator + /// + /// + /// This however is susceptible to overflow if the values in x are large. An + /// alternative more stable way is to subtract the maximum of x from each of the + /// values. + /// + /// + /// + /// def stable_softmax(x): + /// z = x - tf.reduce_max(x) + /// numerator = tf.exp(z) + /// denominator = tf.reduce_sum(numerator) + /// return numerator / denominator + /// + /// + /// However, when we backprop through the softmax to x, we dont want to backprop + /// through the tf.reduce_max(x) (if the max values are not unique then the + /// gradient could flow to the wrong input) calculation and treat that as a + /// constant. Therefore, we should write this out as + /// + /// + /// + /// def stable_softmax(x): + /// z = x - tf.stop_gradient(tf.reduce_max(x)) + /// numerator = tf.exp(z) + /// denominator = tf.reduce_sum(numerator) + /// return numerator / denominator + /// + /// + /// Some other examples include: /// /// * The *EM* algorithm where the *M-step* should not involve backpropagation /// through the output of the *E-step*. @@ -50901,11 +56317,11 @@ public TFOutput StopGradient (TFOutput input, string operName = null) /// begin = [1, 2, x, x, 0, x] # x denotes don't care (usually 0) /// end = [2, 4, x, x, -3, x] /// strides = [1, 1, x, x, -1, 1] - /// begin_mask = 1&lt;&lt;4 | 1 &lt;&lt; 5 = 48 + /// begin_mask = 1&lt;&lt;4 | 1&lt;&lt;5 = 48 /// end_mask = 1&lt;&lt;5 = 32 /// ellipsis_mask = 1&lt;&lt;3 = 8 - /// new_axis_mask = 1&lt;&lt;2 4 - /// shrink_axis_mask = 1&lt;&lt;0 + /// new_axis_mask = 1&lt;&lt;2 = 4 + /// shrink_axis_mask = 1&lt;&lt;0 = 1 /// /// /// In this case if foo.shape is (5, 5, 5, 5, 5, 5) the final shape of @@ -51193,6 +56609,12 @@ public TFOutput StringFormat (TFOutput[] inputs, string template = null, string /// /// /// with the given separator (default is an empty separator). + /// + /// Examples: + /// + /// &gt;&gt;&gt; s = ["hello", "world", "tensorflow"] + /// &gt;&gt;&gt; tf.strings.join(s, " ") + /// &lt;tf.Tensor: shape=(), dtype=string, numpy=b'hello world tensorflow'&gt; /// public TFOutput StringJoin (TFOutput[] inputs, string separator = null, string operName = null) { @@ -51214,7 +56636,7 @@ public TFOutput StringJoin (TFOutput[] inputs, string separator = null, string o /// String lengths of input. /// /// - /// The string for which to compute the length. + /// The strings for which to compute the length for each element. /// /// /// If specified, the created operation in the graph will be this one, otherwise it will be named 'StringLength'. @@ -51234,6 +56656,13 @@ public TFOutput StringJoin (TFOutput[] inputs, string separator = null, string o /// /// /// Computes the length of each string given in the input tensor. + /// + /// &gt;&gt;&gt; strings = tf.constant(['Hello','TensorFlow', '\U0001F642']) + /// &gt;&gt;&gt; tf.strings.length(strings).numpy() # default counts bytes + /// array([ 5, 10, 4], dtype=int32) + /// &gt;&gt;&gt; tf.strings.length(strings, unit="UTF8_CHAR").numpy() + /// array([ 5, 10, 1], dtype=int32) + /// /// public TFOutput StringLength (TFOutput input, string unit = null, string operName = null) { @@ -51251,6 +56680,46 @@ public TFOutput StringLength (TFOutput input, string unit = null, string operNam return output; } + /// + /// Converts all uppercase characters into their respective lowercase replacements. + /// + /// + /// The input to be lower-cased. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'StringLower'. + /// + /// + /// Optional argument + /// Character encoding of input. Allowed values are '' and 'utf-8'. + /// Value '' is interpreted as ASCII. + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Example: + /// + /// &gt;&gt;&gt; tf.strings.lower("CamelCase string and ALL CAPS") + /// &lt;tf.Tensor: shape=(), dtype=string, numpy=b'camelcase string and all caps'&gt; + /// + /// + public TFOutput StringLower (TFOutput input, string encoding = null, string operName = null) + { + var desc = new TFOperationDesc (this, "StringLower", MakeName ("StringLower", operName)); + desc.AddInput (input); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (encoding != null) + desc.SetAttr ("encoding", encoding); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + /// /// Creates ngrams from ragged string data. /// @@ -51465,6 +56934,12 @@ public TFOutput StringLength (TFOutput input, string unit = null, string operNam /// A string Tensor of the same shape as the input. /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// + /// + /// Examples: + /// + /// &gt;&gt;&gt; tf.strings.strip(["\nTensorFlow", " The python library "]).numpy() + /// array([b'TensorFlow', b'The python library'], dtype=object) + /// public TFOutput StringStrip (TFOutput input, string operName = null) { var desc = new TFOperationDesc (this, "StringStrip", MakeName ("StringStrip", operName)); @@ -51538,6 +57013,11 @@ public TFOutput StringToHashBucket (TFOutput string_tensor, long num_buckets, st /// unimportant. There is a risk of adversaries constructing inputs that all hash /// to the same bucket. To prevent this problem, use a strong hash function with /// tf.string_to_hash_bucket_strong. + /// + /// Examples: + /// + /// &gt;&gt;&gt; tf.strings.to_hash_bucket_fast(["Hello", "TensorFlow", "2.x"], 3).numpy() + /// array([0, 2, 2]) /// public TFOutput StringToHashBucketFast (TFOutput input, long num_buckets, string operName = null) { @@ -51587,6 +57067,11 @@ public TFOutput StringToHashBucketFast (TFOutput input, long num_buckets, string /// /// The additional robustness comes at a cost of roughly 4x higher compute /// time than tf.string_to_hash_bucket_fast. + /// + /// Examples: + /// + /// &gt;&gt;&gt; tf.strings.to_hash_bucket_strong(["Hello", "TF"], 3, [1, 2]).numpy() + /// array([2, 0]) /// public TFOutput StringToHashBucketStrong (TFOutput input, long num_buckets, long[] key, string operName = null) { @@ -51622,6 +57107,13 @@ public TFOutput StringToHashBucketStrong (TFOutput input, long num_buckets, long /// /// (Note that int32 overflow results in an error while float overflow /// results in a rounded value.) + /// + /// Example: + /// + /// &gt;&gt;&gt; strings = ["5.0", "3.0", "7.0"] + /// &gt;&gt;&gt; tf.strings.to_number(strings) + /// &lt;tf.Tensor: shape=(3,), dtype=float32, numpy=array([5., 3., 7.], dtype=float32)&gt; + /// /// public TFOutput StringToNumber (TFOutput string_tensor, TFDataType? out_type = null, string operName = null) { @@ -51639,6 +57131,46 @@ public TFOutput StringToNumber (TFOutput string_tensor, TFDataType? out_type = n return output; } + /// + /// Converts all lowercase characters into their respective uppercase replacements. + /// + /// + /// The input to be upper-cased. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'StringUpper'. + /// + /// + /// Optional argument + /// Character encoding of input. Allowed values are '' and 'utf-8'. + /// Value '' is interpreted as ASCII. + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Example: + /// + /// &gt;&gt;&gt; tf.strings.upper("CamelCase string and ALL CAPS") + /// &lt;tf.Tensor: shape=(), dtype=string, numpy=b'CAMELCASE STRING AND ALL CAPS'&gt; + /// + /// + public TFOutput StringUpper (TFOutput input, string encoding = null, string operName = null) + { + var desc = new TFOperationDesc (this, "StringUpper", MakeName ("StringUpper", operName)); + desc.AddInput (input); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (encoding != null) + desc.SetAttr ("encoding", encoding); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + /// /// Returns x - y element-wise. /// @@ -51773,6 +57305,14 @@ public TFOutput Sub (TFOutput x, TFOutput y, string operName = null) /// /// output = [b'hir', b'ee', b'n'] /// + /// + /// Raises: + /// + /// * ValueError: If the first argument cannot be converted to a + /// Tensor of dtype string. + /// * InvalidArgumentError: If indices are out of range. + /// * ValueError: If pos and len are not the same shape. + /// /// public TFOutput Substr (TFOutput input, TFOutput pos, TFOutput len, string unit = null, string operName = null) { @@ -52132,10 +57672,12 @@ public TFOutput Tan (TFOutput x, string operName = null) /// element in the tensor. Input range is [-inf, inf] and /// output range is [-1,1]. /// - /// - /// x = tf.constant([-float("inf"), -5, -0.5, 1, 1.2, 2, 3, float("inf")]) - /// tf.math.tanh(x) ==&gt; [-1. -0.99990916 -0.46211717 0.7615942 0.8336547 0.9640276 0.9950547 1.] - /// + /// &gt;&gt;&gt; x = tf.constant([-float("inf"), -5, -0.5, 1, 1.2, 2, 3, float("inf")]) + /// &gt;&gt;&gt; tf.math.tanh(x) + /// &lt;tf.Tensor: shape=(8,), dtype=float32, numpy= + /// array([-1.0, -0.99990916, -0.46211717, 0.7615942 , 0.8336547 , + /// 0.9640276 , 0.9950547 , 1.0], dtype=float32)&gt; + /// /// public TFOutput Tanh (TFOutput x, string operName = null) { @@ -53014,7 +58556,7 @@ public TFOutput TensorArrayV2 (TFOutput size, TFDataType dtype, TFShape element_ /// /// Optional argument /// If true (default is false), then all - /// elements in the TensorArray will be expected to have have identical shapes. + /// elements in the TensorArray will be expected to have identical shapes. /// This allows certain behaviors, like dynamically checking for /// consistent shapes on write, and being able to fill in properly /// shaped zero tensors on stack -- even if the element_shape attribute @@ -53166,205 +58708,6 @@ public TFOutput TensorDataset (TFOutput[] components, TFShape[] output_shapes, s return handle; } - /// - /// Creates a tree resource and returns a handle to it. - /// - /// - /// Handle to the tree resource to be created. - /// - /// - /// Serialized proto string of the boosted_trees.Tree. - /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'TensorForestCreateTreeVariable'. - /// - /// - /// Returns the description of the operation - /// - public TFOperation TensorForestCreateTreeVariable (TFOutput tree_handle, TFOutput tree_config, string operName = null) - { - var desc = new TFOperationDesc (this, "TensorForestCreateTreeVariable", MakeName ("TensorForestCreateTreeVariable", operName)); - desc.AddInput (tree_handle); - desc.AddInput (tree_config); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - var op = desc.FinishOperation (); - return op; - } - - /// - /// Deserializes a proto into the tree handle - /// - /// - /// Handle to the tree resource to be restored. - /// - /// - /// Serialied proto string of the boosted_trees.Tree proto. - /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'TensorForestTreeDeserialize'. - /// - /// - /// Returns the description of the operation - /// - public TFOperation TensorForestTreeDeserialize (TFOutput tree_handle, TFOutput tree_config, string operName = null) - { - var desc = new TFOperationDesc (this, "TensorForestTreeDeserialize", MakeName ("TensorForestTreeDeserialize", operName)); - desc.AddInput (tree_handle); - desc.AddInput (tree_config); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - var op = desc.FinishOperation (); - return op; - } - - /// - /// Checks whether a tree has been initialized. - /// - /// - /// Handle to the tree. - /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'TensorForestTreeIsInitializedOp'. - /// - /// - /// Whether the tree is initialized. - /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. - /// - public TFOutput TensorForestTreeIsInitializedOp (TFOutput tree_handle, string operName = null) - { - var desc = new TFOperationDesc (this, "TensorForestTreeIsInitializedOp", MakeName ("TensorForestTreeIsInitializedOp", operName)); - desc.AddInput (tree_handle); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - var op = desc.FinishOperation (); - int _idx = 0; - var is_initialized = new TFOutput (op, _idx++); - return is_initialized; - } - - /// - /// Output the logits for the given input data - /// - /// - /// Handle to the tree resource. - /// - /// - /// Rank 2 dense features tensor. - /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'TensorForestTreePredict'. - /// - /// - /// Scalar, dimension of the logits. - /// - /// - /// The logits predictions from the tree for each instance in the batch. - /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. - /// - public TFOutput TensorForestTreePredict (TFOutput tree_handle, TFOutput dense_features, long logits_dimension, string operName = null) - { - var desc = new TFOperationDesc (this, "TensorForestTreePredict", MakeName ("TensorForestTreePredict", operName)); - desc.AddInput (tree_handle); - desc.AddInput (dense_features); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - desc.SetAttr ("logits_dimension", logits_dimension); - var op = desc.FinishOperation (); - int _idx = 0; - var logits = new TFOutput (op, _idx++); - return logits; - } - - /// - /// Creates a handle to a TensorForestTreeResource - /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'TensorForestTreeResourceHandleOp'. - /// - /// - /// Optional argument - /// - /// - /// Optional argument - /// - /// - /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. - /// - public TFOutput TensorForestTreeResourceHandleOp (string container = null, string shared_name = null, string operName = null) - { - var desc = new TFOperationDesc (this, "TensorForestTreeResourceHandleOp", MakeName ("TensorForestTreeResourceHandleOp", operName)); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - if (container != null) - desc.SetAttr ("container", container); - - if (shared_name != null) - desc.SetAttr ("shared_name", shared_name); - - var op = desc.FinishOperation (); - int _idx = 0; - var resource = new TFOutput (op, _idx++); - return resource; - } - - /// - /// Serializes the tree handle to a proto - /// - /// - /// Handle to the tree resource to be serialized. - /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'TensorForestTreeSerialize'. - /// - /// - /// Serialied proto string of the tree resource. - /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. - /// - public TFOutput TensorForestTreeSerialize (TFOutput tree_handle, string operName = null) - { - var desc = new TFOperationDesc (this, "TensorForestTreeSerialize", MakeName ("TensorForestTreeSerialize", operName)); - desc.AddInput (tree_handle); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - var op = desc.FinishOperation (); - int _idx = 0; - var tree_config = new TFOutput (op, _idx++); - return tree_config; - } - - /// - /// Get the number of nodes in a tree - /// - /// - /// Handle to the tree resource. - /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'TensorForestTreeSize'. - /// - /// - /// The size of the tree. - /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. - /// - public TFOutput TensorForestTreeSize (TFOutput tree_handle, string operName = null) - { - var desc = new TFOperationDesc (this, "TensorForestTreeSize", MakeName ("TensorForestTreeSize", operName)); - desc.AddInput (tree_handle); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - var op = desc.FinishOperation (); - int _idx = 0; - var tree_size = new TFOutput (op, _idx++); - return tree_size; - } - /// /// Concats all tensors in the list along the 0th dimension. /// @@ -54024,6 +59367,203 @@ public TFOutput TensorListStack (TFOutput input_handle, TFOutput element_shape, return tensor; } + /// + /// Returns a tensor map with item from given key erased. + /// + /// + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'TensorMapErase'. + /// + /// + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// input_handle: the original map + /// output_handle: the map with value from given key removed + /// key: the key of the value to be erased + /// + public TFOutput TensorMapErase (TFOutput input_handle, TFOutput key, TFDataType value_dtype, string operName = null) + { + var desc = new TFOperationDesc (this, "TensorMapErase", MakeName ("TensorMapErase", operName)); + desc.AddInput (input_handle); + desc.AddInput (key); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("value_dtype", value_dtype); + var op = desc.FinishOperation (); + int _idx = 0; + var output_handle = new TFOutput (op, _idx++); + return output_handle; + } + + /// + /// Returns whether the given key exists in the map. + /// + /// + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'TensorMapHasKey'. + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// input_handle: the input map + /// key: the key to check + /// has_key: whether the key is already in the map or not + /// + public TFOutput TensorMapHasKey (TFOutput input_handle, TFOutput key, string operName = null) + { + var desc = new TFOperationDesc (this, "TensorMapHasKey", MakeName ("TensorMapHasKey", operName)); + desc.AddInput (input_handle); + desc.AddInput (key); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var has_key = new TFOutput (op, _idx++); + return has_key; + } + + /// + /// Returns a map that is the 'input_handle' with the given key-value pair inserted. + /// + /// + /// + /// + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'TensorMapInsert'. + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// input_handle: the original map + /// output_handle: the map with key and value inserted + /// key: the key to be inserted + /// value: the value to be inserted + /// + public TFOutput TensorMapInsert (TFOutput input_handle, TFOutput key, TFOutput value, string operName = null) + { + var desc = new TFOperationDesc (this, "TensorMapInsert", MakeName ("TensorMapInsert", operName)); + desc.AddInput (input_handle); + desc.AddInput (key); + desc.AddInput (value); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var output_handle = new TFOutput (op, _idx++); + return output_handle; + } + + /// + /// Returns the value from a given key in a tensor map. + /// + /// + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'TensorMapLookup'. + /// + /// + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// input_handle: the input map + /// key: the key to be looked up + /// value: the value found from the given key + /// + public TFOutput TensorMapLookup (TFOutput input_handle, TFOutput key, TFDataType value_dtype, string operName = null) + { + var desc = new TFOperationDesc (this, "TensorMapLookup", MakeName ("TensorMapLookup", operName)); + desc.AddInput (input_handle); + desc.AddInput (key); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("value_dtype", value_dtype); + var op = desc.FinishOperation (); + int _idx = 0; + var value = new TFOutput (op, _idx++); + return value; + } + + /// + /// Returns the number of tensors in the input tensor map. + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'TensorMapSize'. + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// input_handle: the input map + /// size: the number of tensors in the map + /// + public TFOutput TensorMapSize (TFOutput input_handle, string operName = null) + { + var desc = new TFOperationDesc (this, "TensorMapSize", MakeName ("TensorMapSize", operName)); + desc.AddInput (input_handle); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var size = new TFOutput (op, _idx++); + return size; + } + + /// + /// Returns a Tensor stack of all keys in a tensor map. + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'TensorMapStackKeys'. + /// + /// + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// input_handle: the input map + /// keys: the returned Tensor of all keys in the map + /// + public TFOutput TensorMapStackKeys (TFOutput input_handle, TFDataType key_dtype, string operName = null) + { + var desc = new TFOperationDesc (this, "TensorMapStackKeys", MakeName ("TensorMapStackKeys", operName)); + desc.AddInput (input_handle); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("key_dtype", key_dtype); + var op = desc.FinishOperation (); + int _idx = 0; + var keys = new TFOutput (op, _idx++); + return keys; + } + /// /// Adds sparse updates to an existing tensor according to indices. /// @@ -54046,21 +59586,22 @@ public TFOutput TensorListStack (TFOutput input_handle, TFOutput element_shape, /// /// This operation creates a new tensor by adding sparse updates to the passed /// in tensor. - /// This operation is very similar to tf.scatter_nd_add, except that the updates + /// This operation is very similar to tf.compat.v1.scatter_nd_add, except that the updates /// are added onto an existing tensor (as opposed to a variable). If the memory /// for the existing tensor cannot be re-used, a copy is made and updated. /// /// indices is an integer tensor containing indices into a new tensor of shape - /// shape. The last dimension of indices can be at most the rank of shape: + /// tensor.shape. The last dimension of indices can be at most the rank of + /// tensor.shape: /// - /// indices.shape[-1] &lt;= shape.rank + /// indices.shape[-1] &lt;= tensor.shape.rank /// /// The last dimension of indices corresponds to indices into elements - /// (if indices.shape[-1] = shape.rank) or slices - /// (if indices.shape[-1] &lt; shape.rank) along dimension indices.shape[-1] of - /// shape. updates is a tensor with shape + /// (if indices.shape[-1] = tensor.shape.rank) or slices + /// (if indices.shape[-1] &lt; tensor.shape.rank) along dimension + /// indices.shape[-1] of tensor.shape. updates is a tensor with shape /// - /// indices.shape[:-1] + shape[indices.shape[-1]:] + /// indices.shape[:-1] + tensor.shape[indices.shape[-1]:] /// /// The simplest form of tensor_scatter_add is to add individual elements to a /// tensor by index. For example, say we want to add 4 elements in a rank-1 @@ -54122,6 +59663,52 @@ public TFOutput TensorScatterAdd (TFOutput tensor, TFOutput indices, TFOutput up return output; } + /// + /// Apply a sparse update to a tensor taking the element-wise maximum. + /// + /// + /// Tensor to update. + /// + /// + /// Index tensor. + /// + /// + /// Updates to scatter into output. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'TensorScatterMax'. + /// + /// + /// A new tensor copied from tensor whose values are element-wise maximum between tensor and updates according to the indices. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Returns a new tensor copied from tensor whose values are element-wise maximum between + /// tensor and updates according to the indices. + /// + /// &gt;&gt;&gt; tensor = [0, 0, 0, 0, 0, 0, 0, 0] + /// &gt;&gt;&gt; indices = [[1], [4], [5]] + /// &gt;&gt;&gt; updates = [1, -1, 1] + /// &gt;&gt;&gt; tf.tensor_scatter_nd_max(tensor, indices, updates).numpy() + /// array([0, 1, 0, 0, 0, 1, 0, 0], dtype=int32) + /// + /// Refer to tf.tensor_scatter_nd_update for more details. + /// + public TFOutput TensorScatterMax (TFOutput tensor, TFOutput indices, TFOutput updates, string operName = null) + { + var desc = new TFOperationDesc (this, "TensorScatterMax", MakeName ("TensorScatterMax", operName)); + desc.AddInput (tensor); + desc.AddInput (indices); + desc.AddInput (updates); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + /// /// Subtracts sparse updates from an existing tensor according to indices. /// @@ -54247,73 +59834,36 @@ public TFOutput TensorScatterSub (TFOutput tensor, TFOutput indices, TFOutput up /// scattered onto an existing tensor (as opposed to a zero-tensor). If the memory /// for the existing tensor cannot be re-used, a copy is made and updated. /// - /// If indices contains duplicates, then their updates are accumulated (summed). + /// If indices contains duplicates, then we pick the last update for the index. /// - /// **WARNING**: The order in which updates are applied is nondeterministic, so the - /// output will be nondeterministic if indices contains duplicates -- because - /// of some numerical approximation issues, numbers summed in different order - /// may yield different results. + /// If an out of bound index is found on CPU, an error is returned. /// - /// indices is an integer tensor containing indices into a new tensor of shape - /// shape. The last dimension of indices can be at most the rank of shape: - /// - /// indices.shape[-1] &lt;= shape.rank + /// **WARNING**: There are some GPU specific semantics for this operation. + /// - If an out of bound index is found, the index is ignored. + /// - The order in which updates are applied is nondeterministic, so the output + /// will be nondeterministic if indices contains duplicates. /// - /// The last dimension of indices corresponds to indices into elements - /// (if indices.shape[-1] = shape.rank) or slices - /// (if indices.shape[-1] &lt; shape.rank) along dimension indices.shape[-1] of - /// shape. updates is a tensor with shape - /// - /// indices.shape[:-1] + shape[indices.shape[-1]:] - /// - /// The simplest form of scatter is to insert individual elements in a tensor by - /// index. For example, say we want to insert 4 scattered elements in a rank-1 - /// tensor with 8 elements. - /// - /// &lt;div style="width:70%; margin:auto; margin-bottom:10px; margin-top:20px;"&gt; - /// &lt;img style="width:100%" src="https://www.tensorflow.org/images/ScatterNd1.png" alt&gt; - /// &lt;/div&gt; - /// - /// In Python, this scatter operation would look like this: - /// - /// - /// indices = tf.constant([[4], [3], [1], [7]]) - /// updates = tf.constant([9, 10, 11, 12]) - /// tensor = tf.ones([8], dtype=tf.int32) - /// updated = tf.tensor_scatter_nd_update(tensor, indices, updates) - /// print(updated) - /// - /// - /// The resulting tensor would look like this: + /// indices is an integer tensor containing indices into a new tensor of shape + /// shape. /// - /// [1, 11, 1, 10, 9, 1, 1, 12] + /// * indices must have at least 2 axes: (num_updates, index_depth). + /// * The last axis of indices is how deep to index into tensor so this index + /// depth must be less than the rank of tensor: indices.shape[-1] &lt;= tensor.ndim /// - /// We can also, insert entire slices of a higher rank tensor all at once. For - /// example, if we wanted to insert two slices in the first dimension of a - /// rank-3 tensor with two matrices of new values. + /// if indices.shape[-1] = tensor.rank this Op indexes and updates scalar elements. + /// if indices.shape[-1] &lt; tensor.rank it indexes and updates slices of the input + /// tensor. /// - /// In Python, this scatter operation would look like this: + /// Each update has a rank of tensor.rank - indices.shape[-1]. + /// The overall shape of updates is: /// /// - /// indices = tf.constant([[0], [2]]) - /// updates = tf.constant([[[5, 5, 5, 5], [6, 6, 6, 6], - /// [7, 7, 7, 7], [8, 8, 8, 8]], - /// [[5, 5, 5, 5], [6, 6, 6, 6], - /// [7, 7, 7, 7], [8, 8, 8, 8]]]) - /// tensor = tf.ones([4, 4, 4],dtype=tf.int32) - /// updated = tf.tensor_scatter_nd_update(tensor, indices, updates) - /// print(updated) + /// indices.shape[:-1] + tensor.shape[indices.shape[-1]:] /// /// - /// The resulting tensor would look like this: - /// - /// [[[5, 5, 5, 5], [6, 6, 6, 6], [7, 7, 7, 7], [8, 8, 8, 8]], - /// [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]], - /// [[5, 5, 5, 5], [6, 6, 6, 6], [7, 7, 7, 7], [8, 8, 8, 8]], - /// [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]] + /// For usage examples see the python [tf.tensor_scatter_nd_update]( + /// https://www.tensorflow.org/api_docs/python/tf/tensor_scatter_nd_update) function /// - /// Note that on CPU, if an out of bound index is found, an error is returned. - /// On GPU, if an out of bound index is found, the index is ignored. /// public TFOutput TensorScatterUpdate (TFOutput tensor, TFOutput indices, TFOutput updates, string operName = null) { @@ -55051,6 +60601,44 @@ public TFOutput Timestamp (string operName = null) return ts; } + /// + /// Converts a tensor to a scalar predicate. + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'ToBool'. + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// Converts a tensor to a scalar predicate with the following rules: + /// + /// - For 0D tensors, truthiness is determined by comparing against a "zero" + /// value. For numerical types it is the obvious zero. For strings it is the + /// empty string. + /// + /// - For &gt;0D tensors, truthiness is determined by looking at the number of + /// elements. If has zero elements, then the result is false. Otherwise the + /// result is true. + /// + /// This matches the behavior of If and While for determining if a tensor counts + /// as true/false for a branch condition. + /// + public TFOutput ToBool (TFOutput input, string operName = null) + { + var desc = new TFOperationDesc (this, "ToBool", MakeName ("ToBool", operName)); + desc.AddInput (input); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + /// /// Finds values and indices of the k largest elements for the last dimension. /// @@ -55107,6 +60695,51 @@ public TFOutput Timestamp (string operName = null) return (values, indices); } + /// + /// Returns the TopK unique values in the array in sorted order. + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'TopKUnique'. + /// + /// + /// + /// + /// Returns a tuple with multiple values, as follows: + /// topk: + /// topk_indices: + /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. + /// + /// + /// The running time is proportional to the product of K and the input + /// size. Sorting the whole array is more efficient for sufficiently large + /// values of K. The median-of-medians algorithm is probably faster, but + /// difficult to implement efficiently in XLA. If there are fewer than K + /// unique numbers (not NANs), the results are padded with negative + /// infinity. NaNs are never returned. Subnormal numbers are flushed to + /// zero. If an element appears at multiple indices, the highest index is + /// returned. If a TopK element never appears in the input due to padding + /// values, the indices are padded with negative one. If a padding value + /// appears in the input and padding is needed, the highest index of the + /// padding value will be returned. The semantics are not the same as + /// kth_order_statistic. + /// + public (TFOutput topk, TFOutput topk_indices) TopKUnique (TFOutput input, long k, string operName = null) + { + var desc = new TFOperationDesc (this, "TopKUnique", MakeName ("TopKUnique", operName)); + desc.AddInput (input); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("k", k); + var op = desc.FinishOperation (); + int _idx = 0; + var topk = new TFOutput (op, _idx++); + var topk_indices = new TFOutput (op, _idx++); + return (topk, topk_indices); + } + /// /// Finds values and indices of the k largest elements for the last dimension. /// @@ -55161,6 +60794,44 @@ public TFOutput Timestamp (string operName = null) return (values, indices); } + /// + /// Returns the TopK values in the array in sorted order. + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'TopKWithUnique'. + /// + /// + /// + /// + /// Returns a tuple with multiple values, as follows: + /// topk: + /// topk_indices: + /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. + /// + /// + /// This is a combination of MakeUnique and TopKUnique. The returned top-K will + /// have its lower bits replaced by iota, thus it will be close to the original + /// value but not exactly the same. The running time is proportional to the product + /// of K and the input size. NaNs are never returned. Subnormal numbers are flushed + /// to zero. + /// + public (TFOutput topk, TFOutput topk_indices) TopKWithUnique (TFOutput input, long k, string operName = null) + { + var desc = new TFOperationDesc (this, "TopKWithUnique", MakeName ("TopKWithUnique", operName)); + desc.AddInput (input); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("k", k); + var op = desc.FinishOperation (); + int _idx = 0; + var topk = new TFOutput (op, _idx++); + var topk_indices = new TFOutput (op, _idx++); + return (topk, topk_indices); + } + /// /// Returns the result of a TPU compilation. /// @@ -55187,6 +60858,34 @@ public TFOutput TPUCompilationResult (string operName = null) return output; } + /// + /// Asserts that compilation succeeded. + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'TPUCompileSucceededAssert'. + /// + /// + /// Returns the description of the operation + /// + /// + /// This op produces no output and closes the device during failure to ensure all + /// pending device interactions fail. + /// + /// 'compilation_status' is a serialized CompilationResultProto. + /// + public TFOperation TPUCompileSucceededAssert (TFOutput compilation_status, string operName = null) + { + var desc = new TFOperationDesc (this, "TPUCompileSucceededAssert", MakeName ("TPUCompileSucceededAssert", operName)); + desc.AddInput (compilation_status); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + return op; + } + /// /// An op enabling differentiation of TPU Embeddings. /// @@ -55233,6 +60932,94 @@ public TFOutput TPUEmbeddingActivations (TFOutput embedding_variable, TFOutput s return output; } + /// + /// Op that loads and executes a TPU program on a TPU device. + /// + /// + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'TPUExecute'. + /// + /// + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// For the internal use of the distributed TPU compiler. + /// + public TFOutput[] TPUExecute (TFOutput[] args, TFOutput key, TFDataType[] Tresults, string operName = null) + { + var desc = new TFOperationDesc (this, "TPUExecute", MakeName ("TPUExecute", operName)); + desc.AddInputs (args); + desc.AddInput (key); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("Tresults", Tresults); + var op = desc.FinishOperation (); + int _idx = 0; + int _n = 0; + _n = op.OutputListLength ("results"); + var results = new TFOutput [_n]; + for (int i = 0; i < _n; i++) + results [i] = new TFOutput (op, _idx++); + + return results; + } + + /// + /// Op that executes a program with optional in-place variable updates. + /// + /// + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'TPUExecuteAndUpdateVariables'. + /// + /// + /// + /// + /// + /// + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// It (optionally) reads device variables, loads and executes a TPU program on a + /// TPU device, and then (optionally) in-place updates variables using the program + /// outputs, as specified in attributes device_var_reads_indices (program input + /// indices from directly reading variables) and device_var_updates_indices (program + /// output indices used to update variables, -1 means no-update/read-only). Such + /// program outputs are consumed by these variables will not appear in the op + /// output. For the internal use of the distributed TPU compiler. + /// + public TFOutput[] TPUExecuteAndUpdateVariables (TFOutput[] args, TFOutput key, TFDataType[] Tresults, long[] device_var_reads_indices, long[] device_var_updates_indices, string operName = null) + { + var desc = new TFOperationDesc (this, "TPUExecuteAndUpdateVariables", MakeName ("TPUExecuteAndUpdateVariables", operName)); + desc.AddInputs (args); + desc.AddInput (key); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("Tresults", Tresults); + desc.SetAttr ("device_var_reads_indices", device_var_reads_indices); + desc.SetAttr ("device_var_updates_indices", device_var_updates_indices); + var op = desc.FinishOperation (); + int _idx = 0; + int _n = 0; + _n = op.OutputListLength ("results"); + var results = new TFOutput [_n]; + for (int i = 0; i < _n; i++) + results [i] = new TFOutput (op, _idx++); + + return results; + } + /// /// A TPU core selector Op. /// @@ -55260,6 +61047,84 @@ public TFOutput TPUOrdinalSelector (string operName = null) return device_ordinals; } + /// + /// An op that groups a list of partitioned inputs together. This op + /// + /// + /// A list of partitioned inputs which must have the same shape. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'TPUPartitionedInput'. + /// + /// + /// Optional argument + /// An integer describles which dimension is partitioned. -1 means + /// those inputs are replicated. + /// + /// + /// A handle which represents the full shape of partitioned tensors. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + public TFOutput TPUPartitionedInput (TFOutput[] inputs, long? partition_dim = null, string operName = null) + { + var desc = new TFOperationDesc (this, "TPUPartitionedInput", MakeName ("TPUPartitionedInput", operName)); + desc.AddInputs (inputs); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (partition_dim.HasValue) + desc.SetAttr ("partition_dim", partition_dim.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + + /// + /// An op that demultiplexes a tensor to be sharded by XLA to a list of partitioned + /// + /// + /// A tensor which represents the full shape of partitioned tensors. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'TPUPartitionedOutput'. + /// + /// + /// Optional argument + /// An integer describles which dimension is partitioned. + /// + /// + /// + /// + /// A list of partitioned inputs which must have the same shape. + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// outputs outside the XLA computation. + /// + public TFOutput[] TPUPartitionedOutput (TFOutput inputs, long num_splits, long? partition_dim = null, string operName = null) + { + var desc = new TFOperationDesc (this, "TPUPartitionedOutput", MakeName ("TPUPartitionedOutput", operName)); + desc.AddInput (inputs); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("num_splits", num_splits); + if (partition_dim.HasValue) + desc.SetAttr ("partition_dim", partition_dim.Value); + + var op = desc.FinishOperation (); + int _idx = 0; + int _n = 0; + _n = op.OutputListLength ("output"); + var output = new TFOutput [_n]; + for (int i = 0; i < _n; i++) + output [i] = new TFOutput (op, _idx++); + + return output; + } + /// /// Connects N inputs to an N-way replicated TPU computation. /// @@ -55268,16 +61133,47 @@ public TFOutput TPUOrdinalSelector (string operName = null) /// /// If specified, the created operation in the graph will be this one, otherwise it will be named 'TPUReplicatedInput'. /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// + /// + /// Optional argument + /// /// /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// - public TFOutput TPUReplicatedInput (TFOutput[] inputs, string operName = null) + /// + /// This operation holds a replicated input to a tpu.replicate() computation subgraph. + /// Each replicated input has the same shape and type alongside the output. + /// + /// For example: + /// + /// %a = "tf.opA"() + /// %b = "tf.opB"() + /// %replicated_input = "tf.TPUReplicatedInput"(%a, %b) + /// %computation = "tf.Computation"(%replicated_input) + /// + /// The above computation has a replicated input of two replicas. + /// + public TFOutput TPUReplicatedInput (TFOutput[] inputs, bool? is_mirrored_variable = null, long? index = null, bool? is_packed = null, string operName = null) { var desc = new TFOperationDesc (this, "TPUReplicatedInput", MakeName ("TPUReplicatedInput", operName)); desc.AddInputs (inputs); foreach ( TFOperation control in CurrentDependencies ) desc.AddControlInput (control); + if (is_mirrored_variable.HasValue) + desc.SetAttr ("is_mirrored_variable", is_mirrored_variable.Value); + + if (index.HasValue) + desc.SetAttr ("index", index.Value); + + if (is_packed.HasValue) + desc.SetAttr ("is_packed", is_packed.Value); + var op = desc.FinishOperation (); int _idx = 0; var output = new TFOutput (op, _idx++); @@ -55285,7 +61181,7 @@ public TFOutput TPUReplicatedInput (TFOutput[] inputs, string operName = null) } /// - /// Connects outputs of an N-way replicated computation to N outputs. + /// Connects N outputs from an N-way replicated TPU computation. /// /// /// @@ -55297,6 +61193,17 @@ public TFOutput TPUReplicatedInput (TFOutput[] inputs, string operName = null) /// /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// + /// + /// This operation holds a replicated output from a tpu.replicate() computation subgraph. + /// Each replicated output has the same shape and type alongside the input. + /// + /// For example: + /// + /// %computation = "tf.Computation"() + /// %replicated_output:2 = "tf.TPUReplicatedOutput"(%computation) + /// + /// The above computation has a replicated output of two replicas. + /// public TFOutput[] TPUReplicatedOutput (TFOutput input, long num_replicas, string operName = null) { var desc = new TFOperationDesc (this, "TPUReplicatedOutput", MakeName ("TPUReplicatedOutput", operName)); @@ -55354,6 +61261,9 @@ public TFOutput[] TPUReplicatedOutput (TFOutput input, long num_replicas, string /// /// Optional argument /// + /// + /// Optional argument + /// /// /// Number of replicas of the computation /// @@ -55363,7 +61273,7 @@ public TFOutput[] TPUReplicatedOutput (TFOutput input, long num_replicas, string /// /// This operation holds the metadata common to operations of a tpu.replicate() computation subgraph. /// - public TFOperation TPUReplicateMetadata (long num_replicas, long? num_cores_per_replica = null, string topology = null, bool? use_tpu = null, long[] device_assignment = null, long[] computation_shape = null, string[] host_compute_core = null, string[] padding_map = null, string step_marker_location = null, bool? allow_soft_placement = null, string operName = null) + public TFOperation TPUReplicateMetadata (long num_replicas, long? num_cores_per_replica = null, string topology = null, bool? use_tpu = null, long[] device_assignment = null, long[] computation_shape = null, string[] host_compute_core = null, string[] padding_map = null, string step_marker_location = null, bool? allow_soft_placement = null, bool? use_spmd_for_xla_partitioning = null, string operName = null) { var desc = new TFOperationDesc (this, "TPUReplicateMetadata", MakeName ("TPUReplicateMetadata", operName)); foreach ( TFOperation control in CurrentDependencies ) @@ -55397,6 +61307,45 @@ public TFOperation TPUReplicateMetadata (long num_replicas, long? num_cores_per_ if (allow_soft_placement.HasValue) desc.SetAttr ("allow_soft_placement", allow_soft_placement.Value); + if (use_spmd_for_xla_partitioning.HasValue) + desc.SetAttr ("use_spmd_for_xla_partitioning", use_spmd_for_xla_partitioning.Value); + + var op = desc.FinishOperation (); + return op; + } + + /// + /// Op that reshards on-device TPU variables to specified state. + /// + /// + /// + /// + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'TPUReshardVariables'. + /// + /// + /// Returns the description of the operation + /// + /// + /// Op that reshards on-device TPU variables to specified state. Internal use only. + /// + /// The sharding state is represented as the key of the compilation that generated + /// the sharding/unsharding programs along with the main program. new_format_key + /// specifies the desired state, and format_state_var is the current state of the + /// variables. + /// + public TFOperation TPUReshardVariables (TFOutput[] vars, TFOutput new_format_key, TFOutput format_state_var, string operName = null) + { + var desc = new TFOperationDesc (this, "TPUReshardVariables", MakeName ("TPUReshardVariables", operName)); + desc.AddInputs (vars); + desc.AddInput (new_format_key); + desc.AddInput (format_state_var); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + var op = desc.FinishOperation (); return op; } @@ -55437,7 +61386,7 @@ public TFOutput Transpose (TFOutput x, TFOutput perm, string operName = null) /// /// /// Tensor of shape [..., 1, M], representing superdiagonals of - /// tri-diagonal matrices to the left of multiplication. Last element is ingored. + /// tri-diagonal matrices to the left of multiplication. Last element is ignored. /// /// /// Tensor of shape [..., 1, M], representing main diagonals of tri-diagonal @@ -55445,7 +61394,7 @@ public TFOutput Transpose (TFOutput x, TFOutput perm, string operName = null) /// /// /// Tensor of shape [..., 1, M], representing subdiagonals of tri-diagonal - /// matrices to the left of multiplication. First element is ingored. + /// matrices to the left of multiplication. First element is ignored. /// /// /// Tensor of shape [..., M, N], representing MxN matrices to the right of @@ -55498,6 +61447,9 @@ public TFOutput TridiagonalMatMul (TFOutput superdiag, TFOutput maindiag, TFOutp /// Whether to apply partial pivoting. Partial pivoting makes the procedure more /// stable, but slower. /// + /// + /// Optional argument + /// /// /// Tensor of shape [..., M, K] containing the solutions /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. @@ -55509,8 +61461,9 @@ public TFOutput TridiagonalMatMul (TFOutput superdiag, TFOutput maindiag, TFOutp /// On CPU, solution is computed via Gaussian elimination with or without partial /// pivoting, depending on partial_pivoting attribute. On GPU, Nvidia's cuSPARSE /// library is used: https://docs.nvidia.com/cuda/cusparse/index.html#gtsv + /// Partial pivoting is not yet supported by XLA backends. /// - public TFOutput TridiagonalSolve (TFOutput diagonals, TFOutput rhs, bool? partial_pivoting = null, string operName = null) + public TFOutput TridiagonalSolve (TFOutput diagonals, TFOutput rhs, bool? partial_pivoting = null, bool? perturb_singular = null, string operName = null) { var desc = new TFOperationDesc (this, "TridiagonalSolve", MakeName ("TridiagonalSolve", operName)); desc.AddInput (diagonals); @@ -55521,6 +61474,9 @@ public TFOutput TridiagonalSolve (TFOutput diagonals, TFOutput rhs, bool? partia if (partial_pivoting.HasValue) desc.SetAttr ("partial_pivoting", partial_pivoting.Value); + if (perturb_singular.HasValue) + desc.SetAttr ("perturb_singular", perturb_singular.Value); + var op = desc.FinishOperation (); int _idx = 0; var output = new TFOutput (op, _idx++); @@ -55649,129 +61605,6 @@ public TFOutput TruncateMod (TFOutput x, TFOutput y, string operName = null) return z; } - /// - /// Perform batches of RPC requests. - /// - /// - /// 0-D or 1-D. The address (i.e. host_name:port) of the RPC server. - /// If this tensor has more than 1 element, then multiple parallel rpc requests - /// are sent. This argument broadcasts with method and request. - /// - /// - /// 0-D or 1-D. The method address on the RPC server. - /// If this tensor has more than 1 element, then multiple parallel rpc requests - /// are sent. This argument broadcasts with address and request. - /// - /// - /// 0-D or 1-D. Serialized proto strings: the rpc request argument. - /// If this tensor has more than 1 element, then multiple parallel rpc requests - /// are sent. This argument broadcasts with address and method. - /// - /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'TryRpc'. - /// - /// - /// Optional argument - /// RPC protocol to use. Empty string means use the default protocol. - /// Options include 'grpc'. - /// - /// - /// Optional argument - /// boolean. If true (default), then failures to connect - /// (i.e., the server does not immediately respond) cause an RPC failure. - /// - /// - /// Optional argument - /// int. If 0 (default), then the kernel will run the RPC - /// request and only time out if the RPC deadline passes or the session times out. - /// If this value is greater than 0, then the op will raise an exception if - /// the RPC takes longer than timeout_in_ms. - /// - /// - /// Returns a tuple with multiple values, as follows: - /// response: Same shape as request. Serialized proto strings: the rpc responses. - /// status_code: Same shape as request. Values correspond to tensorflow Status enum codes. - /// status_message: Same shape as request. Values correspond to Status messages - /// returned from the RPC calls. - /// The TFOperation can be fetched from any of the TFOutputs returned in the tuple values, by fethching the Operation property. - /// - /// - /// This op asynchronously performs either a single RPC request, or a batch - /// of requests. RPC requests are defined by three main parameters: - /// - /// - address (the host+port or BNS address of the request) - /// - method (the method name for the request) - /// - request (the serialized proto string, or vector of strings, - /// of the RPC request argument). - /// - /// For example, if you have an RPC service running on port localhost:2345, - /// and its interface is configured with the following proto declaration: - /// - /// - /// service MyService { - /// rpc MyMethod(MyRequestProto) returns (MyResponseProto) { - /// } - /// }; - /// - /// - /// then call this op with arguments: - /// - /// - /// address = "localhost:2345" - /// method = "MyService/MyMethod" - /// - /// - /// The request tensor is a string tensor representing serialized MyRequestProto - /// strings; and the output string tensor response will have the same shape - /// and contain (upon successful completion) corresponding serialized - /// MyResponseProto strings. - /// - /// For example, to send a single, empty, MyRequestProto, call - /// this op with request = "". To send 5 **parallel** empty requests, - /// call this op with request = ["", "", "", "", ""]. - /// - /// More generally, one can create a batch of MyRequestProto serialized protos - /// from regular batched tensors using the encode_proto op, and convert - /// the response MyResponseProto serialized protos to batched tensors - /// using the decode_proto op. - /// - /// **NOTE** Working with serialized proto strings is faster than instantiating - /// actual proto objects in memory, so no performance degradation is expected - /// compared to writing custom kernels for this workflow. - /// - /// Unlike the standard Rpc op, if the connection fails or the remote worker - /// returns an error status, this op does **not** reraise the exception. - /// Instead, the status_code and status_message entry for the corresponding RPC - /// call is set with the error returned from the RPC call. The response tensor - /// will contain valid response values for those minibatch entries whose RPCs did - /// not fail; the rest of the entries will have empty strings. - /// - public (TFOutput response, TFOutput status_code, TFOutput status_message) TryRpc (TFOutput address, TFOutput method, TFOutput request, string protocol = null, bool? fail_fast = null, long? timeout_in_ms = null, string operName = null) - { - var desc = new TFOperationDesc (this, "TryRpc", MakeName ("TryRpc", operName)); - desc.AddInput (address); - desc.AddInput (method); - desc.AddInput (request); - foreach ( TFOperation control in CurrentDependencies ) - desc.AddControlInput (control); - - if (protocol != null) - desc.SetAttr ("protocol", protocol); - - if (fail_fast.HasValue) - desc.SetAttr ("fail_fast", fail_fast.Value); - - if (timeout_in_ms.HasValue) - desc.SetAttr ("timeout_in_ms", timeout_in_ms.Value); - - var op = desc.FinishOperation (); - int _idx = 0; - var response = new TFOutput (op, _idx++); - var status_code = new TFOutput (op, _idx++); - var status_message = new TFOutput (op, _idx++); - return (response, status_code, status_message); - } - /// /// Reverses the operation of Batch for a single output Tensor. /// @@ -55928,6 +61761,41 @@ public TFOutput UnbatchGrad (TFOutput original_input, TFOutput batch_index, TFOu return batched_grad; } + /// + /// Uncompresses a compressed dataset element. + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'UncompressElement'. + /// + /// + /// + /// + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + public TFOutput[] UncompressElement (TFOutput compressed, TFDataType[] output_types, TFShape[] output_shapes, string operName = null) + { + var desc = new TFOperationDesc (this, "UncompressElement", MakeName ("UncompressElement", operName)); + desc.AddInput (compressed); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("output_types", output_types); + desc.SetAttrShape ("output_shapes", output_shapes); + var op = desc.FinishOperation (); + int _idx = 0; + int _n = 0; + _n = op.OutputListLength ("components"); + var components = new TFOutput [_n]; + for (int i = 0; i < _n; i++) + components [i] = new TFOutput (op, _idx++); + + return components; + } + /// /// Decodes each string in input into a sequence of Unicode code points. /// @@ -56202,9 +62070,22 @@ public TFOutput UnicodeEncode (TFOutput input_values, TFOutput input_splits, str /// /// This operation converts Unicode code points to script codes corresponding to /// each code point. Script codes correspond to International Components for - /// Unicode (ICU) UScriptCode values. See http://icu-project.org/apiref/icu4c/uscript_8h.html. + /// Unicode (ICU) UScriptCode values. + /// + /// See + /// [ICU project docs](http://icu-project.org/apiref/icu4c/uscript_8h.html) + /// for more details on script codes. + /// + /// For an example, see the unicode strings guide on [unicode scripts] + /// (https://www.tensorflow.org/tutorials/load_data/unicode#representing_unicode). + /// /// Returns -1 (USCRIPT_INVALID_CODE) for invalid codepoints. Output shape will /// match input shape. + /// + /// Examples: + /// + /// &gt;&gt;&gt; tf.strings.unicode_script([1, 31, 38]) + /// &lt;tf.Tensor: shape=(3,), dtype=int32, numpy=array([0, 0, 0], dtype=int32)&gt; /// public TFOutput UnicodeScript (TFOutput input, string operName = null) { @@ -56292,6 +62173,16 @@ public TFOutput UnicodeScript (TFOutput input, string operName = null) /// transcoding is faithful to all codepoints in the source. If it is not marked /// with an explicit endianness, the BOM is not considered part of the string itself /// but as metadata, and so is not preserved in the output. + /// + /// Examples: + /// + /// &gt;&gt;&gt; tf.strings.unicode_transcode(["Hello", "TensorFlow", "2.x"], "UTF-8", "UTF-16-BE") + /// &lt;tf.Tensor: shape=(3,), dtype=string, numpy= + /// array([b'\x00H\x00e\x00l\x00l\x00o', + /// b'\x00T\x00e\x00n\x00s\x00o\x00r\x00F\x00l\x00o\x00w', + /// b'\x002\x00.\x00x'], dtype=object)&gt; + /// &gt;&gt;&gt; tf.strings.unicode_transcode(["A", "B", "C"], "US ASCII", "UTF-8").numpy() + /// array([b'A', b'B', b'C'], dtype=object) /// public TFOutput UnicodeTranscode (TFOutput input, string input_encoding, string output_encoding, string errors = null, long? replacement_char = null, bool? replace_control_characters = null, string operName = null) { @@ -56670,33 +62561,33 @@ public TFOutput UniqueDataset (TFOutput input_dataset, TFDataType[] output_types /// For example: /// /// - /// # tensor 'x' is [1, 1, 2, 4, 4, 4, 7, 8, 8] - /// y, idx, count = unique_with_counts(x) + /// x = tf.constant([1, 1, 2, 4, 4, 4, 7, 8, 8]) + /// y, idx, count = UniqueWithCountsV2(x, axis = [0]) /// y ==&gt; [1, 2, 4, 7, 8] /// idx ==&gt; [0, 0, 1, 2, 2, 2, 3, 4, 4] /// count ==&gt; [2, 1, 3, 1, 2] /// /// - /// For an 2-D tensor x with axis = 0: + /// For a 2-D tensor x with axis = 0: /// /// - /// # tensor 'x' is [[1, 0, 0], - /// # [1, 0, 0], - /// # [2, 0, 0]] - /// y, idx, count = unique_with_counts(x, axis=0) + /// x = tf.constant([[1, 0, 0], + /// [1, 0, 0], + /// [2, 0, 0]]) + /// y, idx, count = UniqueWithCountsV2(x, axis=[0]) /// y ==&gt; [[1, 0, 0], /// [2, 0, 0]] /// idx ==&gt; [0, 0, 1] /// count ==&gt; [2, 1] /// /// - /// For an 2-D tensor x with axis = 1: + /// For a 2-D tensor x with axis = 1: /// /// - /// # tensor 'x' is [[1, 0, 0], - /// # [1, 0, 0], - /// # [2, 0, 0]] - /// y, idx, count = unique_with_counts(x, axis=1) + /// x = tf.constant([[1, 0, 0], + /// [1, 0, 0], + /// [2, 0, 0]]) + /// y, idx, count = UniqueWithCountsV2(x, axis=[1]) /// y ==&gt; [[1, 0], /// [1, 0], /// [2, 0]] @@ -56910,6 +62801,10 @@ public TFOutput UnsortedSegmentJoin (TFOutput inputs, TFOutput segment_ids, TFOu /// /// /// A tensor whose shape is a prefix of data.shape. + /// The values must be less than num_segments. + /// + /// Caution: The values are always validated to be in range on CPU, never validated + /// on GPU. /// /// /// @@ -56927,8 +62822,7 @@ public TFOutput UnsortedSegmentJoin (TFOutput inputs, TFOutput segment_ids, TFOu /// [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) /// for an explanation of segments. /// - /// This operator is similar to the unsorted segment sum operator found - /// [(here)](../../../api_docs/python/math_ops.md#UnsortedSegmentSum). + /// This operator is similar to tf.math.unsorted_segment_sum, /// Instead of computing the sum over segments, it computes the maximum such that: /// /// \\(output_i = \max_{j...} data[j...]\\) where max is over tuples j... such @@ -56941,19 +62835,23 @@ public TFOutput UnsortedSegmentJoin (TFOutput inputs, TFOutput segment_ids, TFOu /// If the given segment ID i is negative, then the corresponding value is /// dropped, and will not be included in the result. /// + /// Caution: On CPU, values in segment_ids are always validated to be less than + /// num_segments, and an error is thrown for out-of-bound indices. On GPU, this + /// does not throw an error for out-of-bound indices. On Gpu, out-of-bound indices + /// result in safe but unspecified behavior, which may include ignoring + /// out-of-bound indices or outputting a tensor with a 0 stored in the first + /// dimension of its shape if num_segments is 0. + /// /// &lt;div style="width:70%; margin:auto; margin-bottom:10px; margin-top:20px;"&gt; /// &lt;img style="width:100%" src="https://www.tensorflow.org/images/UnsortedSegmentMax.png" alt&gt; /// &lt;/div&gt; /// /// For example: /// - /// - /// python - /// c = tf.constant([[1,2,3,4], [5,6,7,8], [4,3,2,1]]) - /// tf.unsorted_segment_max(c, tf.constant([0, 1, 0]), num_segments=2) - /// # ==&gt; [[ 4, 3, 3, 4], - /// # [5, 6, 7, 8]] - /// + /// &gt;&gt;&gt; c = tf.constant([[1,2,3,4], [5,6,7,8], [4,3,2,1]]) + /// &gt;&gt;&gt; tf.math.unsorted_segment_max(c, tf.constant([0, 1, 0]), num_segments=2).numpy() + /// array([[4, 3, 3, 4], + /// [5, 6, 7, 8]], dtype=int32) /// /// public TFOutput UnsortedSegmentMax (TFOutput data, TFOutput segment_ids, TFOutput num_segments, string operName = null) @@ -56978,6 +62876,10 @@ public TFOutput UnsortedSegmentMax (TFOutput data, TFOutput segment_ids, TFOutpu /// /// /// A tensor whose shape is a prefix of data.shape. + /// The values must be less than num_segments. + /// + /// Caution: The values are always validated to be in range on CPU, never validated + /// on GPU. /// /// /// @@ -56995,8 +62897,7 @@ public TFOutput UnsortedSegmentMax (TFOutput data, TFOutput segment_ids, TFOutpu /// [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) /// for an explanation of segments. /// - /// This operator is similar to the unsorted segment sum operator found - /// [(here)](../../../api_docs/python/math_ops.md#UnsortedSegmentSum). + /// This operator is similar to tf.math.unsorted_segment_sum, /// Instead of computing the sum over segments, it computes the minimum such that: /// /// \\(output_i = \min_{j...} data_[j...]\\) where min is over tuples j... such @@ -57008,16 +62909,20 @@ public TFOutput UnsortedSegmentMax (TFOutput data, TFOutput segment_ids, TFOutpu /// /// For example: /// - /// - /// python - /// c = tf.constant([[1,2,3,4], [5,6,7,8], [4,3,2,1]]) - /// tf.unsorted_segment_min(c, tf.constant([0, 1, 0]), num_segments=2) - /// # ==&gt; [[ 1, 2, 2, 1], - /// # [5, 6, 7, 8]] - /// + /// &gt;&gt;&gt; c = tf.constant([[1,2,3,4], [5,6,7,8], [4,3,2,1]]) + /// &gt;&gt;&gt; tf.math.unsorted_segment_min(c, tf.constant([0, 1, 0]), num_segments=2).numpy() + /// array([[1, 2, 2, 1], + /// [5, 6, 7, 8]], dtype=int32) /// /// If the given segment ID i is negative, then the corresponding value is /// dropped, and will not be included in the result. + /// + /// Caution: On CPU, values in segment_ids are always validated to be less than + /// num_segments, and an error is thrown for out-of-bound indices. On GPU, this + /// does not throw an error for out-of-bound indices. On Gpu, out-of-bound indices + /// result in safe but unspecified behavior, which may include ignoring + /// out-of-bound indices or outputting a tensor with a 0 stored in the first + /// dimension of its shape if num_segments is 0. /// public TFOutput UnsortedSegmentMin (TFOutput data, TFOutput segment_ids, TFOutput num_segments, string operName = null) { @@ -57041,6 +62946,10 @@ public TFOutput UnsortedSegmentMin (TFOutput data, TFOutput segment_ids, TFOutpu /// /// /// A tensor whose shape is a prefix of data.shape. + /// The values must be less than num_segments. + /// + /// Caution: The values are always validated to be in range on CPU, never validated + /// on GPU. /// /// /// @@ -57058,8 +62967,7 @@ public TFOutput UnsortedSegmentMin (TFOutput data, TFOutput segment_ids, TFOutpu /// [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) /// for an explanation of segments. /// - /// This operator is similar to the unsorted segment sum operator found - /// [(here)](../../../api_docs/python/math_ops.md#UnsortedSegmentSum). + /// This operator is similar to tf.math.unsorted_segment_sum, /// Instead of computing the sum over segments, it computes the product of all /// entries belonging to a segment such that: /// @@ -57068,18 +62976,22 @@ public TFOutput UnsortedSegmentMin (TFOutput data, TFOutput segment_ids, TFOutpu /// /// For example: /// - /// - /// python - /// c = tf.constant([[1,2,3,4], [5,6,7,8], [4,3,2,1]]) - /// tf.unsorted_segment_prod(c, tf.constant([0, 1, 0]), num_segments=2) - /// # ==&gt; [[ 4, 6, 6, 4], - /// # [5, 6, 7, 8]] - /// + /// &gt;&gt;&gt; c = tf.constant([[1,2,3,4], [5,6,7,8], [4,3,2,1]]) + /// &gt;&gt;&gt; tf.math.unsorted_segment_prod(c, tf.constant([0, 1, 0]), num_segments=2).numpy() + /// array([[4, 6, 6, 4], + /// [5, 6, 7, 8]], dtype=int32) /// /// If there is no entry for a given segment ID i, it outputs 1. /// /// If the given segment ID i is negative, then the corresponding value is /// dropped, and will not be included in the result. + /// Caution: On CPU, values in segment_ids are always validated to be less than + /// num_segments, and an error is thrown for out-of-bound indices. On GPU, this + /// does not throw an error for out-of-bound indices. On Gpu, out-of-bound indices + /// result in safe but unspecified behavior, which may include ignoring + /// out-of-bound indices or outputting a tensor with a 0 stored in the first + /// dimension of its shape if num_segments is 0. + /// /// public TFOutput UnsortedSegmentProd (TFOutput data, TFOutput segment_ids, TFOutput num_segments, string operName = null) { @@ -57103,6 +63015,10 @@ public TFOutput UnsortedSegmentProd (TFOutput data, TFOutput segment_ids, TFOutp /// /// /// A tensor whose shape is a prefix of data.shape. + /// The values must be less than num_segments. + /// + /// Caution: The values are always validated to be in range on CPU, never validated + /// on GPU. /// /// /// @@ -57132,17 +63048,22 @@ public TFOutput UnsortedSegmentProd (TFOutput data, TFOutput segment_ids, TFOutp /// /// num_segments should equal the number of distinct segment IDs. /// + /// Caution: On CPU, values in segment_ids are always validated to be less than + /// num_segments, and an error is thrown for out-of-bound indices. On GPU, this + /// does not throw an error for out-of-bound indices. On Gpu, out-of-bound indices + /// result in safe but unspecified behavior, which may include ignoring + /// out-of-bound indices or outputting a tensor with a 0 stored in the first + /// dimension of its shape if num_segments is 0. + /// /// &lt;div style="width:70%; margin:auto; margin-bottom:10px; margin-top:20px;"&gt; /// &lt;img style="width:100%" src="https://www.tensorflow.org/images/UnsortedSegmentSum.png" alt&gt; /// &lt;/div&gt; /// - /// - /// python - /// c = tf.constant([[1,2,3,4], [5,6,7,8], [4,3,2,1]]) - /// tf.unsorted_segment_sum(c, tf.constant([0, 1, 0]), num_segments=2) - /// # ==&gt; [[ 5, 5, 5, 5], - /// # [5, 6, 7, 8]] - /// + /// &gt;&gt;&gt; c = [[1,2,3,4], [5,6,7,8], [4,3,2,1]] + /// &gt;&gt;&gt; tf.math.unsorted_segment_sum(c, [0, 1, 0], num_segments=2).numpy() + /// array([[5, 5, 5, 5], + /// [5, 6, 7, 8]], dtype=int32) + /// /// /// public TFOutput UnsortedSegmentSum (TFOutput data, TFOutput segment_ids, TFOutput num_segments, string operName = null) @@ -57289,6 +63210,11 @@ public TFOutput UpperBound (TFOutput sorted_inputs, TFOutput values, TFDataType? /// Optional argument /// the name by which this variable is referred to. /// + /// + /// Optional argument + /// DEPRECATED. The allowed devices containing the resource variable. Set when the + /// output ResourceHandle represents a per-replica/partitioned resource variable. + /// /// /// the type of this variable. Must agree with the dtypes /// of all ops using this variable. @@ -57299,7 +63225,7 @@ public TFOutput UpperBound (TFOutput sorted_inputs, TFOutput values, TFDataType? /// /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// - public TFOutput VarHandleOp (TFDataType dtype, TFShape shape, string container = null, string shared_name = null, string operName = null) + public TFOutput VarHandleOp (TFDataType dtype, TFShape shape, string container = null, string shared_name = null, string[] allowed_devices = null, string operName = null) { var desc = new TFOperationDesc (this, "VarHandleOp", MakeName ("VarHandleOp", operName)); foreach ( TFOperation control in CurrentDependencies ) @@ -57313,6 +63239,9 @@ public TFOutput VarHandleOp (TFDataType dtype, TFShape shape, string container = if (shared_name != null) desc.SetAttr ("shared_name", shared_name); + if (allowed_devices != null) + desc.SetAttr ("allowed_devices", allowed_devices); + var op = desc.FinishOperation (); int _idx = 0; var resource = new TFOutput (op, _idx++); @@ -57646,24 +63575,69 @@ public TFOutput WholeFileReaderV2 (string container = null, string shared_name = } /// - /// A dataset that creates window datasets from the input dataset. + /// Combines (nests of) input elements into a dataset of (nests of) windows. + /// + /// A "window" is a finite dataset of flat elements of size size (or possibly + /// fewer if there are not enough input elements to fill the window and + /// drop_remainder evaluates to false). + /// + /// The shift argument determines the number of input elements by which + /// the window moves on each iteration. The first element in the kth window + /// will be element + /// + /// + /// 1 + (k-1) * shift + /// + /// + /// of the input dataset. In particular, the first element of the first window + /// will always be the first element of the input dataset. + /// + /// If the stride parameter is greater than 1, then each window will skip + /// (stride - 1) input elements between each element that appears in the + /// window. Output windows will still contain size elements regardless of + /// the value of stride. + /// + /// The stride argument determines the stride of the input elements, and the + /// shift argument determines the shift of the window. + /// + /// For example, letting {...} to represent a Dataset: + /// + /// - tf.data.Dataset.range(7).window(2) produces + /// {{0, 1}, {2, 3}, {4, 5}, {6}} + /// - tf.data.Dataset.range(7).window(3, 2, 1, True) produces + /// {{0, 1, 2}, {2, 3, 4}, {4, 5, 6}} + /// - tf.data.Dataset.range(7).window(3, 1, 2, True) produces + /// {{0, 2, 4}, {1, 3, 5}, {2, 4, 6}} + /// + /// Note that when the window transformation is applied to a dataset of + /// nested elements, it produces a dataset of nested windows. + /// + /// For example: + /// + /// - tf.data.Dataset.from_tensor_slices((range(4), range(4))).window(2) + /// produces {({0, 1}, {0, 1}), ({2, 3}, {2, 3})} + /// - tf.data.Dataset.from_tensor_slices({"a": range(4)}).window(2) + /// produces {{"a": {0, 1}}, {"a": {2, 3}}} /// /// /// /// - /// A scalar representing the number of elements to accumulate in a window. + /// An integer scalar, representing the number of elements + /// of the input dataset to combine into a window. Must be positive. /// /// - /// A scalar representing the steps moving the sliding window forward in one - /// iteration. It must be positive. + /// An integer scalar, representing the number of input elements + /// by which the window moves in each iteration. Defaults to size. + /// Must be positive. /// /// - /// A scalar representing the stride of the input elements of the sliding window. - /// It must be positive. + /// An integer scalar, representing the stride of the input elements + /// in the sliding window. Must be positive. The default value of 1 means + /// "retain every input element". /// /// - /// A scalar representing whether a window should be dropped in case its size is - /// smaller than desired. + /// A Boolean scalar, representing whether the last window should be + /// dropped if its size is smaller than window_size. /// /// /// If specified, the created operation in the graph will be this one, otherwise it will be named 'WindowDataset'. @@ -57725,7 +63699,51 @@ public TFOutput WorkerHeartbeat (TFOutput request, string operName = null) } /// - /// Writes contents to the file at input filename. Creates file and recursively + /// Writes an audio summary. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'WriteAudioSummary'. + /// + /// + /// Optional argument + /// + /// + /// Returns the description of the operation + /// + /// + /// Writes encoded audio summary tensor at step with tag using summary writer. + /// sample_rate is the audio sample rate is Hz. + /// + public TFOperation WriteAudioSummary (TFOutput writer, TFOutput step, TFOutput tag, TFOutput tensor, TFOutput sample_rate, long? max_outputs = null, string operName = null) + { + var desc = new TFOperationDesc (this, "WriteAudioSummary", MakeName ("WriteAudioSummary", operName)); + desc.AddInput (writer); + desc.AddInput (step); + desc.AddInput (tag); + desc.AddInput (tensor); + desc.AddInput (sample_rate); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (max_outputs.HasValue) + desc.SetAttr ("max_outputs", max_outputs.Value); + + var op = desc.FinishOperation (); + return op; + } + + /// + /// Writes contents to the file at input filename. /// /// /// scalar. The name of the file to which we write the contents. @@ -57740,7 +63758,7 @@ public TFOutput WorkerHeartbeat (TFOutput request, string operName = null) /// Returns the description of the operation /// /// - /// creates directory if not existing. + /// Creates the file and recursively creates directory if it does not exist. /// public TFOperation WriteFile (TFOutput filename, TFOutput contents, string operName = null) { @@ -57754,6 +63772,217 @@ public TFOperation WriteFile (TFOutput filename, TFOutput contents, string operN return op; } + /// + /// Writes a graph summary. + /// + /// + /// + /// + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'WriteGraphSummary'. + /// + /// + /// Returns the description of the operation + /// + /// + /// Writes TensorFlow graph tensor at step using summary writer. + /// + public TFOperation WriteGraphSummary (TFOutput writer, TFOutput step, TFOutput tensor, string operName = null) + { + var desc = new TFOperationDesc (this, "WriteGraphSummary", MakeName ("WriteGraphSummary", operName)); + desc.AddInput (writer); + desc.AddInput (step); + desc.AddInput (tensor); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + return op; + } + + /// + /// Writes a histogram summary. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'WriteHistogramSummary'. + /// + /// + /// Returns the description of the operation + /// + /// + /// Writes histogram values at step with tag using summary writer. + /// + public TFOperation WriteHistogramSummary (TFOutput writer, TFOutput step, TFOutput tag, TFOutput values, string operName = null) + { + var desc = new TFOperationDesc (this, "WriteHistogramSummary", MakeName ("WriteHistogramSummary", operName)); + desc.AddInput (writer); + desc.AddInput (step); + desc.AddInput (tag); + desc.AddInput (values); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + return op; + } + + /// + /// Writes an image summary. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'WriteImageSummary'. + /// + /// + /// Optional argument + /// + /// + /// Returns the description of the operation + /// + /// + /// Writes image tensor at step with tag using summary writer. + /// tensor is image with shape [height, width, channels]. + /// + public TFOperation WriteImageSummary (TFOutput writer, TFOutput step, TFOutput tag, TFOutput tensor, TFOutput bad_color, long? max_images = null, string operName = null) + { + var desc = new TFOperationDesc (this, "WriteImageSummary", MakeName ("WriteImageSummary", operName)); + desc.AddInput (writer); + desc.AddInput (step); + desc.AddInput (tag); + desc.AddInput (tensor); + desc.AddInput (bad_color); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (max_images.HasValue) + desc.SetAttr ("max_images", max_images.Value); + + var op = desc.FinishOperation (); + return op; + } + + /// + /// Writes a serialized proto summary. + /// + /// + /// + /// + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'WriteRawProtoSummary'. + /// + /// + /// Returns the description of the operation + /// + /// + /// Writes tensor, a serialized proto at step using summary writer. + /// + public TFOperation WriteRawProtoSummary (TFOutput writer, TFOutput step, TFOutput tensor, string operName = null) + { + var desc = new TFOperationDesc (this, "WriteRawProtoSummary", MakeName ("WriteRawProtoSummary", operName)); + desc.AddInput (writer); + desc.AddInput (step); + desc.AddInput (tensor); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + return op; + } + + /// + /// Writes a scalar summary. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'WriteScalarSummary'. + /// + /// + /// Returns the description of the operation + /// + /// + /// Writes scalar value at step with tag using summary writer. + /// + public TFOperation WriteScalarSummary (TFOutput writer, TFOutput step, TFOutput tag, TFOutput value, string operName = null) + { + var desc = new TFOperationDesc (this, "WriteScalarSummary", MakeName ("WriteScalarSummary", operName)); + desc.AddInput (writer); + desc.AddInput (step); + desc.AddInput (tag); + desc.AddInput (value); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + return op; + } + + /// + /// Writes a tensor summary. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'WriteSummary'. + /// + /// + /// Returns the description of the operation + /// + /// + /// Writes tensor at step with tag using summary writer. + /// + public TFOperation WriteSummary (TFOutput writer, TFOutput step, TFOutput tensor, TFOutput tag, TFOutput summary_metadata, string operName = null) + { + var desc = new TFOperationDesc (this, "WriteSummary", MakeName ("WriteSummary", operName)); + desc.AddInput (writer); + desc.AddInput (step); + desc.AddInput (tensor); + desc.AddInput (tag); + desc.AddInput (summary_metadata); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + return op; + } + /// /// Returns 0 if x == 0, and x / y otherwise, elementwise. /// @@ -57872,7 +64101,68 @@ public TFOutput XlaClusterOutput (TFOutput input, string operName = null) /// number of feature groups for grouped convolution. /// /// - /// If specified, the created operation in the graph will be this one, otherwise it will be named 'XlaConv'. + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'XlaConv'. + /// + /// + /// a serialized xla::ConvolutionDimensionNumbers proto. + /// + /// + /// a serialized xla::PrecisionConfig proto. + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// https://www.tensorflow.org/performance/xla/operation_semantics#conv_convolution + /// . + /// + public TFOutput XlaConv (TFOutput lhs, TFOutput rhs, TFOutput window_strides, TFOutput padding, TFOutput lhs_dilation, TFOutput rhs_dilation, TFOutput feature_group_count, string dimension_numbers, string precision_config, string operName = null) + { + var desc = new TFOperationDesc (this, "XlaConv", MakeName ("XlaConv", operName)); + desc.AddInput (lhs); + desc.AddInput (rhs); + desc.AddInput (window_strides); + desc.AddInput (padding); + desc.AddInput (lhs_dilation); + desc.AddInput (rhs_dilation); + desc.AddInput (feature_group_count); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("dimension_numbers", dimension_numbers); + desc.SetAttr ("precision_config", precision_config); + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + + /// + /// Wraps the XLA ConvGeneralDilated operator, documented at + /// + /// + /// the input tensor + /// + /// + /// the kernel tensor + /// + /// + /// the inter-window strides + /// + /// + /// the padding to apply at the start and end of each input dimensions + /// + /// + /// dilation to apply between input elements + /// + /// + /// dilation to apply between kernel elements + /// + /// + /// number of feature groups for grouped convolution. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'XlaConvV2'. /// /// /// a serialized xla::ConvolutionDimensionNumbers proto. @@ -57880,6 +64170,9 @@ public TFOutput XlaClusterOutput (TFOutput input, string operName = null) /// /// a serialized xla::PrecisionConfig proto. /// + /// + /// The type of the tensor. + /// /// /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// @@ -57887,9 +64180,9 @@ public TFOutput XlaClusterOutput (TFOutput input, string operName = null) /// https://www.tensorflow.org/performance/xla/operation_semantics#conv_convolution /// . /// - public TFOutput XlaConv (TFOutput lhs, TFOutput rhs, TFOutput window_strides, TFOutput padding, TFOutput lhs_dilation, TFOutput rhs_dilation, TFOutput feature_group_count, string dimension_numbers, string precision_config, string operName = null) + public TFOutput XlaConvV2 (TFOutput lhs, TFOutput rhs, TFOutput window_strides, TFOutput padding, TFOutput lhs_dilation, TFOutput rhs_dilation, TFOutput feature_group_count, string dimension_numbers, string precision_config, TFDataType preferred_element_type, string operName = null) { - var desc = new TFOperationDesc (this, "XlaConv", MakeName ("XlaConv", operName)); + var desc = new TFOperationDesc (this, "XlaConvV2", MakeName ("XlaConvV2", operName)); desc.AddInput (lhs); desc.AddInput (rhs); desc.AddInput (window_strides); @@ -57902,6 +64195,7 @@ public TFOutput XlaConv (TFOutput lhs, TFOutput rhs, TFOutput window_strides, TF desc.SetAttr ("dimension_numbers", dimension_numbers); desc.SetAttr ("precision_config", precision_config); + desc.SetAttrType ("preferred_element_type", preferred_element_type); var op = desc.FinishOperation (); int _idx = 0; var output = new TFOutput (op, _idx++); @@ -57937,7 +64231,7 @@ public TFOutput XlaConv (TFOutput lhs, TFOutput rhs, TFOutput window_strides, TF /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// /// - /// Dequantization on deivce. + /// Dequantization on device. /// public TFOutput XlaDequantize (TFOutput input, float min_range, float max_range, string mode, bool transpose_output, string operName = null) { @@ -57997,6 +64291,51 @@ public TFOutput XlaDot (TFOutput lhs, TFOutput rhs, string dimension_numbers, st return output; } + /// + /// Wraps the XLA DotGeneral operator, documented at + /// + /// + /// the LHS tensor + /// + /// + /// the RHS tensor + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'XlaDotV2'. + /// + /// + /// a serialized xla::DotDimensionNumbers proto. + /// + /// + /// a serialized xla::PrecisionConfig proto. + /// + /// + /// The type of the tensor. + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// https://www.tensorflow.org/performance/xla/operation_semantics#dotgeneral + /// . + /// + public TFOutput XlaDotV2 (TFOutput lhs, TFOutput rhs, string dimension_numbers, string precision_config, TFDataType preferred_element_type, string operName = null) + { + var desc = new TFOperationDesc (this, "XlaDotV2", MakeName ("XlaDotV2", operName)); + desc.AddInput (lhs); + desc.AddInput (rhs); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("dimension_numbers", dimension_numbers); + desc.SetAttr ("precision_config", precision_config); + desc.SetAttrType ("preferred_element_type", preferred_element_type); + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + /// /// Wraps the XLA DynamicSlice operator, documented at /// @@ -58104,7 +64443,7 @@ public TFOutput XlaDynamicUpdateSlice (TFOutput input, TFOutput update, TFOutput /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. /// /// - /// This op has better TPU performnce since it doesn't have explicitly reshape and + /// This op has better TPU performance since it doesn't have explicitly reshape and /// transpose operations as tf.einsum does. /// public TFOutput XlaEinsum (TFOutput a, TFOutput b, string equation, string operName = null) @@ -58122,6 +64461,50 @@ public TFOutput XlaEinsum (TFOutput a, TFOutput b, string equation, string operN return product; } + /// + /// Wraps the XLA Gather operator documented at + /// + /// + /// The array we're gathering from. + /// + /// + /// Array containing the starting indices of the slices we gather. + /// + /// + /// slice_sizes[i] is the bounds for the slice on dimension i. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'XlaGather'. + /// + /// + /// A serialized xla::GatherDimensionNumbers proto. + /// + /// + /// Boolean indicating if the indices are sorted. + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// https://www.tensorflow.org/xla/operation_semantics#gather + /// + public TFOutput XlaGather (TFOutput operand, TFOutput start_indices, TFOutput slice_sizes, string dimension_numbers, bool indices_are_sorted, string operName = null) + { + var desc = new TFOperationDesc (this, "XlaGather", MakeName ("XlaGather", operName)); + desc.AddInput (operand); + desc.AddInput (start_indices); + desc.AddInput (slice_sizes); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("dimension_numbers", dimension_numbers); + desc.SetAttr ("indices_are_sorted", indices_are_sorted); + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + /// /// Wraps the XLA Sort operator, documented at /// @@ -58171,13 +64554,17 @@ public TFOutput XlaEinsum (TFOutput a, TFOutput b, string equation, string operN /// A scalar Tensor of type T. /// /// - /// the padding to apply at the start of each input dimensions + /// the padding to apply at the start of each input dimensions. Must + /// be a compile-time constant 1D tensor of length equal to rank of input. /// /// - /// the padding to apply at the end of each input dimension. + /// the padding to apply at the end of each input dimension. Must + /// be a compile-time constant 1D tensor of length equal to rank of input. /// /// - /// the padding to apply between each input element. + /// the padding to apply between each input element. Must + /// be a compile-time constant 1D tensor of length equal to rank of input, + /// containing only non-negative values. /// /// /// If specified, the created operation in the graph will be this one, otherwise it will be named 'XlaPad'. @@ -58245,6 +64632,73 @@ public TFOutput XlaRecv (TFDataType dtype, string tensor_name, TFShape shape, st return tensor; } + /// + /// An op to receive a tensor from the host. + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'XlaRecvFromHost'. + /// + /// + /// + /// + /// + /// + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// output: the tensor that will be received from the host. + /// Toutput: element type for output. + /// shape: shape for output. + /// key: A unique identifier for this region used to match up host transfers. + /// + public TFOutput XlaRecvFromHost (TFDataType Toutput, TFShape shape, string key, string operName = null) + { + var desc = new TFOperationDesc (this, "XlaRecvFromHost", MakeName ("XlaRecvFromHost", operName)); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttrType ("Toutput", Toutput); + desc.SetAttrShape ("shape", shape); + desc.SetAttr ("key", key); + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + + /// + /// Inverse of XlaSetDynamicDimensionSize. Make an xla bounded + /// + /// + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'XlaRemoveDynamicDimensionSize'. + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// dynamic dimension into a static dimension. The bound of the size of + /// dimension dim_index becomes the static dimension size. + /// + public TFOutput XlaRemoveDynamicDimensionSize (TFOutput input, TFOutput dim_index, string operName = null) + { + var desc = new TFOperationDesc (this, "XlaRemoveDynamicDimensionSize", MakeName ("XlaRemoveDynamicDimensionSize", operName)); + desc.AddInput (input); + desc.AddInput (dim_index); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + /// /// Replica ID. /// @@ -58282,7 +64736,7 @@ public TFOutput XlaReplicaId (string operName = null) /// /// maximum number of sweep update, i.e., the whole lower triangular /// part or upper triangular part based on parameter lower. Heuristically, it has - /// been argued that approximatly logN sweeps are needed in practice (Ref: Golub & + /// been argued that approximately logN sweeps are needed in practice (Ref: Golub & /// van Loan "Matrix Computation"). /// /// @@ -58351,6 +64805,130 @@ public TFOperation XlaSend (TFOutput tensor, string tensor_name, string operName return op; } + /// + /// An op to send a tensor to the host. + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'XlaSendToHost'. + /// + /// + /// + /// + /// Returns the description of the operation + /// + /// + /// input: the tensor that will be sent to the host. + /// Tinput: element type for input. + /// key: A unique identifier for this region used to match up host transfers. + /// + public TFOperation XlaSendToHost (TFOutput input, string key, string operName = null) + { + var desc = new TFOperationDesc (this, "XlaSendToHost", MakeName ("XlaSendToHost", operName)); + desc.AddInput (input); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("key", key); + var op = desc.FinishOperation (); + return op; + } + + /// + /// Set a bound for the given input value as a hint to Xla compiler, + /// + /// + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'XlaSetBound'. + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// returns the same value. + /// + public TFOutput XlaSetBound (TFOutput input, TFOutput bound, string operName = null) + { + var desc = new TFOperationDesc (this, "XlaSetBound", MakeName ("XlaSetBound", operName)); + desc.AddInput (input); + desc.AddInput (bound); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + + /// + /// Make a static dimension into a xla bounded dynamic dimension. + /// + /// + /// + /// + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'XlaSetDynamicDimensionSize'. + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// The current static dimension size will become the bound and the second + /// operand becomes the dynamic size of the dimension. + /// + public TFOutput XlaSetDynamicDimensionSize (TFOutput input, TFOutput dim_index, TFOutput size, string operName = null) + { + var desc = new TFOperationDesc (this, "XlaSetDynamicDimensionSize", MakeName ("XlaSetDynamicDimensionSize", operName)); + desc.AddInput (input); + desc.AddInput (dim_index); + desc.AddInput (size); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + + /// + /// An op which shards the input based on the given sharding attribute. + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'XlaSharding'. + /// + /// + /// Optional argument + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + public TFOutput XlaSharding (TFOutput input, string sharding = null, string operName = null) + { + var desc = new TFOperationDesc (this, "XlaSharding", MakeName ("XlaSharding", operName)); + desc.AddInput (input); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + if (sharding != null) + desc.SetAttr ("sharding", sharding); + + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + /// /// Wraps the XLA Sort operator, documented at /// @@ -58383,6 +64961,74 @@ public TFOutput XlaSort (TFOutput input, string operName = null) return output; } + /// + /// An op used by XLA SPMD partitioner to switch from automatic partitioning to + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'XlaSpmdFullToShardShape'. + /// + /// + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// manual partitioning. It annotates the input (full-shape, to be automatically + /// partitioned) with the same sharding used by manual partitioning, and outputs a + /// shard-shaped tensor to be consumed by later manually-partitioned ops. If the + /// shape is not evenly partitionable, the padding region will be masked with 0s. + /// + public TFOutput XlaSpmdFullToShardShape (TFOutput input, string manual_sharding, string operName = null) + { + var desc = new TFOperationDesc (this, "XlaSpmdFullToShardShape", MakeName ("XlaSpmdFullToShardShape", operName)); + desc.AddInput (input); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("manual_sharding", manual_sharding); + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + + /// + /// An op used by XLA SPMD partitioner to switch from manual partitioning to + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'XlaSpmdShardToFullShape'. + /// + /// + /// + /// + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + /// + /// automatic partitioning. It converts the shard-shaped, manually partitioned input + /// into full-shaped tensor to be partitioned automatically with the same sharding + /// used by manual partitioning. + /// + public TFOutput XlaSpmdShardToFullShape (TFOutput input, string manual_sharding, TFShape full_shape, string operName = null) + { + var desc = new TFOperationDesc (this, "XlaSpmdShardToFullShape", MakeName ("XlaSpmdShardToFullShape", operName)); + desc.AddInput (input); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + desc.SetAttr ("manual_sharding", manual_sharding); + desc.SetAttrShape ("full_shape", full_shape); + var op = desc.FinishOperation (); + int _idx = 0; + var output = new TFOutput (op, _idx++); + return output; + } + /// /// Computes the eigen decomposition of a batch of self-adjoint matrices /// @@ -58395,7 +65041,7 @@ public TFOutput XlaSort (TFOutput input, string operName = null) /// /// maximum number of sweep update, i.e., the whole lower triangular /// part or upper triangular part based on parameter lower. Heuristically, it has - /// been argued that approximatly log(min (M, N)) sweeps are needed in practice + /// been argued that approximately log(min (M, N)) sweeps are needed in practice /// (Ref: Golub & van Loan "Matrix Computation"). /// /// @@ -58436,6 +65082,33 @@ public TFOutput XlaSort (TFOutput input, string operName = null) return (s, u, v); } + /// + /// Returns 0 if x == 0, and x * log1p(y) otherwise, elementwise. + /// + /// + /// + /// + /// + /// + /// If specified, the created operation in the graph will be this one, otherwise it will be named 'Xlog1py'. + /// + /// + /// The TFOperation can be fetched from the resulting TFOutput, by fethching the Operation property from the result. + /// + public TFOutput Xlog1py (TFOutput x, TFOutput y, string operName = null) + { + var desc = new TFOperationDesc (this, "Xlog1py", MakeName ("Xlog1py", operName)); + desc.AddInput (x); + desc.AddInput (y); + foreach ( TFOperation control in CurrentDependencies ) + desc.AddControlInput (control); + + var op = desc.FinishOperation (); + int _idx = 0; + var z = new TFOutput (op, _idx++); + return z; + } + /// /// Returns 0 if x == 0, and x * log(y) otherwise, elementwise. /// diff --git a/TensorFlowSharp/TensorFlowSharp.csproj b/TensorFlowSharp/TensorFlowSharp.csproj index b4c5179e..c5bec68f 100644 --- a/TensorFlowSharp/TensorFlowSharp.csproj +++ b/TensorFlowSharp/TensorFlowSharp.csproj @@ -1,4 +1,4 @@ - + netstandard2.0 @@ -9,13 +9,13 @@ bin\Debug\TensorFlowSharp.xml true 0.1 - 1.15.0 + 2.8.0 true TensorFlowSharp - 1.15.3 + 2.8.0 Miguel de Icaza https://github.com/migueldeicaza/TensorFlowSharp/blob/master/LICENSE https://github.com/migueldeicaza/TensorFlowSharp/ @@ -23,20 +23,9 @@ .NET Bindings for TensorFlow Miguel de Icaza .NET API for TensorFlow, Google's Machine Intelligence framework - 1.15.3: Fixed libtensorflow.dll not being copied to output directory on .NET Core; 1.15.1: Add a Runner.Run method that does not allocate - contribution from Enrico Minack; 1.15.0: Updated to TensorFlow 1.15; 1.13.1: Fixes boolean and ushort tensor construction fixes from Enrico Minack; Runner.AddInput fixes from Colin Versteeg; captainst provided a convenience function for the samples; Zeeshan Ahmed added AdamOptimizer; Kevin Malenfant fixes a few bugs; Enrico Minack added support for mutable tensors; 1.13.0: An optimization implementation now exists for C#, contributed by Zeeshan Ahmed from the Microsoft data science team (RMSProp, SGD optimizer bindings); TFSession now has a static method for loading models; New methods for loading strings into tensors (also Zeeshan) + 2.8.0: Updated to TensorFlow 2.8.0; 1.15.3: Fixed libtensorflow.dll not being copied to output directory on .NET Core; 1.15.1: Add a Runner.Run method that does not allocate - contribution from Enrico Minack; 1.15.0: Updated to TensorFlow 1.15; 1.13.1: Fixes boolean and ushort tensor construction fixes from Enrico Minack; Runner.AddInput fixes from Colin Versteeg; captainst provided a convenience function for the samples; Zeeshan Ahmed added AdamOptimizer; Kevin Malenfant fixes a few bugs; Enrico Minack added support for mutable tensors; 1.13.0: An optimization implementation now exists for C#, contributed by Zeeshan Ahmed from the Microsoft data science team (RMSProp, SGD optimizer bindings); TFSession now has a static method for loading models; New methods for loading strings into tensors (also Zeeshan) - - - - - - - - - - - diff --git a/TensorFlowSharp/nuget/build/net45/TensorFlowSharp.targets b/TensorFlowSharp/nuget/build/net45/TensorFlowSharp.targets deleted file mode 100644 index 758b74dd..00000000 --- a/TensorFlowSharp/nuget/build/net45/TensorFlowSharp.targets +++ /dev/null @@ -1,27 +0,0 @@ - - - - - true - true - - - True - - - - - %(Filename)%(Extension) - PreserveNewest - - - %(Filename)%(Extension) - PreserveNewest - - - %(Filename)%(Extension) - PreserveNewest - - - - \ No newline at end of file