功能旧方法新方法
检查是否默认图tf.get_default_graph()tf.compat.v1.get_default_graph()
会话的创建tf.Session()tf.compat.v1.Session()
设置配置tf.ConfigProto()tf.compat.v1.ConfigProto()
交互式会话tf.InteractiveSession()tf.compat.v1.InteractiveSession()
初始化变量tf.global_variables_initializer()tf.compat.v1.global_variables_initializer()
创建随机数tf.random_normal()tf.random.normal()
创建占位符tf.placeholder()tf.compat.v1.placeholder()
分配变量值tf.assign()tf.compat.v1.assign()
变量加法tf.assign_add()tf.compat.v1.assign_add()
取变量tf.get_variable()tf.compat.v1.get_variable()
指定变量作用域tf.variable_scope()tf.compat.v1.variable_scope()
取变量tf.get_variable()tf.compat.v1.get_variable()
tensorboard相关方法tf.summary()tf.compat.v1.summary()
训练tf.train()tf.compat.v1.train()
等概率随机数tf.random_uniform()tf.random.uniform()
设置随机数种子tf.set_random_seed()tf.compat.v1.set_random_seed()
log对数计算tf.log()tf.math.log()
取默认的图tf.get_default_graph()tf.compat.v1.get_default_graph()
读取tf.read_file()tf.io.read_file()
调整图片尺寸tf.image.resize()tf.image.resize_images()
图像的剪切tf.image.resize_image_with_crop_or_pad()tf.image.resize_with_crop_or_pad()
图像的转置tf.image.transpose_image()tf.image.transpose()
最大池化tf.nn.max_pool()tf.nn.max_pool2d()