codecamp

TensorFlow函数:tf.string_to_hash_bucket_strong

tf.string_to_hash_bucket_strong函数

tf.string_to_hash_bucket_strong(
    input,
    num_buckets,
    key,
    name=None
)

请参阅指南:字符串操作>散列

与tf.string_to_hash_bucket_fast函数的作用一样,tf.string_to_hash_bucket_strong函数也是通过多个 bucket 将输入张量中的每个字符串转换为哈希模式.

哈希函数对进程内字符串的内容是确定性的.散列函数是一个密钥散列函数,其中属性 key 定义散列函数的密钥.key 是 2 个元素的数组.

当输入可能是恶意的时,强大的散列很重要,例如带有附加组件的 URL.攻击者可以尝试将他们的输入散列到同一个 bucket 中以进行拒绝服务攻击或扭曲结果.如果不是不可行的话,强大的散列通过使其难以计算散列到相同 bucket 的输入来防止这种情况.这比tf.string_to_hash_bucket_fast函数的计算时间要多出大约4倍.

函数参数:

  • input:一个 string 类型的 Tensor,要分配散列桶的字符串.
  • num_buckets:一个大于等于1的 int,bucket 的数量.
  • key:ints 列表.密钥散列函数的密钥以两个 uint64 元素的列表形式传递.
  • name:操作的名称(可选).

函数返回值:

tf.string_to_hash_bucket_strong函数返回一个 int64 类型的 Tensor.

TensorFlow函数:tf.string_to_hash_bucket_fast
TensorFlow函数:tf.string_to_number
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

TensorFlow 函数介绍

TensorFlow 函数模块:tf

TensorFlow的image模块

TensorFlow使用之tf.io

TensorFlow使用之tf.keras

TensorFlow函数教程:tf.keras.applications

TensorFlow函数教程:tf.keras.backend

TensorFlow使用之tf.metrics

TensorFlow使用之tf.nn

TensorFlow使用之tf.python_io

TensorFlow 功能函数

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }