MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / bincount_v1

Function bincount_v1

tensorflow/python/ops/math_ops.py:3222–3250  ·  view source on GitHub ↗

Counts the number of occurrences of each value in an integer array. If `minlength` and `maxlength` are not given, returns a vector with length `tf.reduce_max(arr) + 1` if `arr` is non-empty, and length 0 otherwise. If `weights` are non-None, then index `i` of the output stores the sum of the

(arr,
                weights=None,
                minlength=None,
                maxlength=None,
                dtype=dtypes.int32)

Source from the content-addressed store, hash-verified

3220@tf_export(v1=["math.bincount", "bincount"])
3221@deprecation.deprecated_endpoints("bincount")
3222def bincount_v1(arr,
3223 weights=None,
3224 minlength=None,
3225 maxlength=None,
3226 dtype=dtypes.int32):
3227 """Counts the number of occurrences of each value in an integer array.
3228
3229 If `minlength` and `maxlength` are not given, returns a vector with length
3230 `tf.reduce_max(arr) + 1` if `arr` is non-empty, and length 0 otherwise.
3231 If `weights` are non-None, then index `i` of the output stores the sum of the
3232 value in `weights` at each index where the corresponding value in `arr` is
3233 `i`.
3234
3235 Args:
3236 arr: An int32 tensor of non-negative values.
3237 weights: If non-None, must be the same shape as arr. For each value in
3238 `arr`, the bin will be incremented by the corresponding weight instead of
3239 1.
3240 minlength: If given, ensures the output has length at least `minlength`,
3241 padding with zeros at the end if necessary.
3242 maxlength: If given, skips values in `arr` that are equal or greater than
3243 `maxlength`, ensuring that the output has length at most `maxlength`.
3244 dtype: If `weights` is None, determines the type of the output bins.
3245
3246 Returns:
3247 A vector with the same dtype as `weights` or the given `dtype`. The bin
3248 values.
3249 """
3250 return bincount(arr, weights, minlength, maxlength, dtype)
3251
3252
3253@tf_export("math.cumsum", "cumsum")

Callers

nothing calls this directly

Calls 1

bincountFunction · 0.85

Tested by

no test coverage detected