# -*- coding: utf-8 -*-
# Created by 'Zhou Bingbing' on 2019/7/6
import os
import tensorflow as tf
# t= tf.constant(['cafe','coffee','咖啡'])
# print(tf.strings.length(t,unit='UTF8_CHAR'))
# s=tf.SparseTensor(indices=[[0,1],[1,0],[2,3]],values=[1,2,3],dense_shape=[3,4])
# print(s)
# print(tf.sparse.to_dense(s))
# v=tf.Variable([[1,2,3],[4,5,6]])
# print(v)
# print(v.value())
# print(v.numpy())
# @tf.function
# def scaled_elu(z,scale=1.0,alpha=1.0):
# is_positive=tf.greater_equal(z,0.0)
# return scale*tf.where(is_positive,z,alpha*scale*tf.nn.elu(z))
# # print(scaled_elu(tf.constant(tf.constant(-3.0))))
# # print(scaled_elu(tf.constant(tf.constant([-3,-2.5]))))
# #
# # print('tf.function')
# scaled_elu_tf = tf.function(scaled_elu)
# # print(scaled_elu_tf(tf.constant(-3.0)))
# # print(scaled_elu_tf(tf.constant([-3.0,-2.5])))
#
# # %timeit scaled_el
tensorflow2.0 教程2
最新推荐文章于 2022-07-24 10:15:17 发布