tensorflow tf.encode_base64()(将字符串编码为网络安全的base64格式)
生活随笔
收集整理的這篇文章主要介紹了
tensorflow tf.encode_base64()(将字符串编码为网络安全的base64格式)
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
@tf_export('io.encode_base64', 'encode_base64')
@deprecated_endpoints('encode_base64')
def encode_base64(input, pad=False, name=None):r"""Encode strings into web-safe base64 format.將字符串編碼為網(wǎng)絡(luò)安全的base64格式。Refer to the following article for more information on base64 format:en.wikipedia.org/wiki/Base64. Base64 strings may have padding with '=' at theend so that the encoded has length multiple of 4. See Padding section of thelink above.有關(guān)base64格式的更多信息,請(qǐng)參考以下文章:zh.wikipedia.org/wiki/Base64。 Base64字符串的結(jié)尾可能帶有'='填充,因此編碼后的字符串的長(zhǎng)度倍數(shù)為4。請(qǐng)參見(jiàn)上面鏈接的“填充”部分。Web-safe means that the encoder uses - and _ instead of + and /.Web安全意味著編碼器使用-和_而不是+和/。Args:input: A `Tensor` of type `string`. Strings to be encoded.類(lèi)型為string的Tensor。 需要被編碼的字符串。pad: An optional `bool`. Defaults to `False`.Bool whether padding is applied at the ends.可選的`bool`。 默認(rèn)為False。布爾型是否在兩端使用填充。name: A name for the operation (optional). 操作的名稱(chēng)(可選)。Returns:A `Tensor` of type `string`. 類(lèi)型為string的Tensor。"""_ctx = _context._contextif _ctx is None or not _ctx._eager_context.is_eager:if pad is None:pad = Falsepad = _execute.make_bool(pad, "pad")_, _, _op = _op_def_lib._apply_op_helper("EncodeBase64", input=input, pad=pad, name=name)_result = _op.outputs[:]_inputs_flat = _op.inputs_attrs = ("pad", _op.get_attr("pad"))_execute.record_gradient("EncodeBase64", _inputs_flat, _attrs, _result, name)_result, = _resultreturn _resultelse:try:_result = _pywrap_tensorflow.TFE_Py_FastPathExecute(_ctx._context_handle, _ctx._eager_context.device_name, "EncodeBase64",name, _ctx._post_execution_callbacks, input, "pad", pad)return _resultexcept _core._FallbackException:return encode_base64_eager_fallback(input, pad=pad, name=name, ctx=_ctx)except _core._NotOkStatusException as e:if name is not None:message = e.message + " name: " + nameelse:message = e.message_six.raise_from(_core._status_to_exception(e.code, message), None)
總結(jié)
以上是生活随笔為你收集整理的tensorflow tf.encode_base64()(将字符串编码为网络安全的base64格式)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: GPU和显卡是什么关系?GPU会取代CP
- 下一篇: tensorflow tf.matmul