tf.estimator
estimator同keras是tensorflow的高级API。在tensorflow1.13以上,estimator已经作为一个单独的package从tensorflow分离出来了。
estimator抽象了tensorflow底层的api, 同keras一样,他分离了model和data, 不同于keras这个不得不认养的儿子,estimator作为tensorflow的亲儿子,天生具有分布式的基因,更容易在生产环境里面使用
tensorflow官方文档提供了比较详细的estimator程序的构建过程:
https://www.tensorflow.org/guide#estimators
tensorflow model提供了estimator构建的mnist程序:
https://github.com/tensorflow/models/blob/master/official/mnist/mnist.py
estimator模型由model_fn决定:
官方文档:
其中features, labels是必需的。model, params, config参数是可选的
如下是estiamtor定义的一个模型:
1 |
def (features, labels, mode, params): |
可以看见features, labels分别是模型的input,output。所以是必须的。但是在有的模型里面。比如bert预训练的模型里面,我们不需要训练,所以只用到features。
tf.estimator的更多相关文章
- 机器学习笔记5-Tensorflow高级API之tf.estimator
前言 本文接着上一篇继续来聊Tensorflow的接口,上一篇中用较低层的接口实现了线性模型,本篇中将用更高级的API--tf.estimator来改写线性模型. 还记得之前的文章<机器学习笔记 ...
- import tensorflow 报错: tf.estimator package not installed.
import tensorflow 报错: tf.estimator package not installed. 解决方案1: 安装 pip install tensorflow-estimator ...
- tf.estimator.Estimator类的用法
官网链接:https://www.tensorflow.org/api_docs/python/tf/estimator/Estimator Estimator - 一种可极大地简化机器学习编程的高阶 ...
- tf.estimator.Estimator
1.定义 tf.estimator.Estimator(model_fn=model_fn) #model_fn是一个方法 2.定义model_fn: def model_fn_builder(sel ...
- 启动Tensorboard时发生错误:class BeholderHook(tf.estimator.SessionRunHook): AttributeError: module 'tensorflow.python.estimator.estimator_lib' has no attribute 'SessionRunHook'
报错:class BeholderHook(tf.estimator.SessionRunHook):AttributeError: module 'tensorflow.python.estimat ...
- tensorflow estimator API小栗子
TensorFlow的高级机器学习API(tf.estimator)可以轻松配置,训练和评估各种机器学习模型. 在本教程中,您将使用tf.estimator构建一个神经网络分类器,并在Iris数据集上 ...
- tensorflow创建自定义 Estimator
https://www.tensorflow.org/guide/custom_estimators?hl=zh-cn 创建自定义 Estimator 本文档介绍了自定义 Estimator.具体而言 ...
- Tensorflow1.4 高级接口使用(estimator, data, keras, layers)
TensorFlow 高级接口使用简介(estimator, keras, data, experiment) TensorFlow 1.4正式添加了keras和data作为其核心代码(从contri ...
- TensorFlow 1.4利用Keras+Estimator API进行训练和预测
Tensorflow 1.4中,Keras作为作为核心模块可以直接通过tf.keas进行调用,但是考虑到keras对tfrecords文件进行操作比较麻烦,而将keras模型转成tensorflow中 ...
随机推荐
- [Algo] 118. Array Deduplication IV
Given an unsorted integer array, remove adjacent duplicate elements repeatedly, from left to right. ...
- 第3章 ZooKeeper基本数据模型
第3章 ZooKeeper基本数据模型 3-1 zk数据模型介绍 3-2 zk客户端连接关闭服务端,查看znode ./zkCli.sh Ctrl + C 退出 =================== ...
- 如何升级Powershell How to upgrade powershell 5
查看当前版本 Win+R 输入 powershell 进入. 输入:$PSVersionTable 可以看到PS的version: 当前是2.0 下载WMF Windows Management Fr ...
- this, 闭包,箭头函数
闭包写法 //后台每个执行环境都有一个表示变量的对象---变量对象 //例如compare()函数调用 //compare的执行环境而言,其作用域链包含两个变量对象 本地活动对象 全局活动对象 全局变 ...
- ZJNU 1365 - Window--中级
每次都寻找长度为k的区间内的最小值显然很容易超出时间限制 所以可以把窗户看作一个数量固定的队列 每次观察入列与出列的元素对答案贡献如何,以更新答案 /* Written By StelaYuri */ ...
- java 里没有友元函数怎么办
我希望一个service可以访问某个对象中的私有对象,但是不希望这个私有对象暴露给其它的service. public xxxServiceImpl{ public void do(){ xxxent ...
- Linux系统如何记录时间
1.内核在开机启动的时候会读取RTC硬件获取一个时间作为初始基准时间,这个基准时间对应一个jiiffies值(这个基准时间换算成jiffies值的方法是:用这个时间减去1970-01-01 00:0 ...
- fiddler抓包可以抓到电脑数据抓不到手机上的数据------防火墙问题
1.确保手机与电脑处于同一局域网,网络没问题,手机代理设置无误 2.确保fiddler设置没有任何问题 3.如果此时还是无法抓包,请打开控制面板----Windows防火墙------允许程序通过Wi ...
- PyTorch基础——迁移学习
一.介绍 内容 使机器能够"举一反三"的能力 知识点 使用 PyTorch 的数据集套件从本地加载数据的方法 迁移训练好的大型神经网络模型到自己模型中的方法 迁移学习与普通深度学习 ...
- @ResponseBody与@RestController
@ResponseBody与@RestController的作用与区别 https://blog.csdn.net/xfl4629712/article/details/78528387