自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

TensorFlow 2.7正式版上線,支持Jax模型到TensorFlow Lite轉(zhuǎn)換

開發(fā) 前端
TensorFlow2.7 正式發(fā)布,新版本包括對(duì) tf.keras、tf.lite 等模塊的改進(jìn);tf.data 現(xiàn)在可以支持自動(dòng)分片(auto-sharding);添加實(shí)驗(yàn)性 API Experiment_from_jax 以支持從 Jax 模型到 TensorFlow Lite 的轉(zhuǎn)換。

 

「調(diào)試代碼(debug)是框架用戶體驗(yàn)的關(guān)鍵部分,更輕松的調(diào)試意味著更快的迭代周期。在此版本中,我們通過(guò)三個(gè)主要更改對(duì) TF/Keras 調(diào)試體驗(yàn)進(jìn)行了廣泛的重新設(shè)計(jì),使其更高效、更有趣……」谷歌科學(xué)家,Keras 發(fā)明者 François Chollet 說(shuō)道。

11 月 5 日,TensorFlow 官方發(fā)布了 2.7 正式版,距離上次 2.6.1 的更新剛過(guò)去一個(gè)月時(shí)間。

TensorFlow 2.7正式版上線,支持Jax模型到TensorFlow Lite轉(zhuǎn)換

在 TensorFlow 博客上,官方簡(jiǎn)述了新版本的主要升級(jí)內(nèi)容:

TensorFlow 2.7 主要變化

tf.keras:

  • Model.fit()、 Model.predict() 和 Model.evaluate()方法將不再把 (batch_size, ) 的輸入數(shù)據(jù)上升為 (batch_size, 1)。這使得 Model 子類能夠在其 train_step()/ test_step()/ predict_step()方法中處理標(biāo)量數(shù)據(jù);
  • Model.to_yaml()和 keras.models.model_from_yaml 方法已被替換為引發(fā) RuntimeError,因?yàn)樗鼈兛赡鼙粸E用以導(dǎo)致任意代碼執(zhí)行。建議使用 JSON 序列化而不是 YAML,或者,一個(gè)更好的替代方案,序列化到 H5;
  • LinearModel 和 WideDeepModel 被移至 tf.compat.v1.keras.models. 命名空間( tf.compat.v1.keras.models.LinearModel 和 tf.compat.v1.keras.models.WideDeepModel),其 experimental 端點(diǎn) tf.keras.experimental.models.LinearModel 和 tf.keras.experimental.models.WideDeepModel 被棄用;
  • 所有 tf.keras.initializers 類的 RNG 行為改變,這一變化將使初始化行為在 v1 和 v2 之間保持一致。

tf.lite:

  • 重命名 schema 中的 SignatureDef 表,以最大化與 TF SavedModel Signature 概念的奇偶校驗(yàn)。
  • 棄用 Makefile 構(gòu)建,Makefile 用戶需要將他們的構(gòu)建遷移到 CMake 或 Bazel。
  • 棄用 tflite::OpResolver::GetDelegates。TfLite 的 BuiltinOpResolver::GetDelegates 所返回的列表現(xiàn)在總是空的。相反,建議使用新方法 tflite::OpResolver::GetDelegateCreators。

TF Core:

  • tf.Graph.get_name_scope() 現(xiàn)在總是返回一個(gè)字符串。之前當(dāng)在 name_scope("") 或 name_scope(None) 上下文中調(diào)用時(shí),它返回 None, 現(xiàn)在它返回空字符串;
  • tensorflow/core/ir/ 包含一個(gè)新的基于 MLIR 的 Graph dialect,它與 GraphDef 同構(gòu),并將用于替換基于 GraphDef(例如 Grappler)的優(yōu)化;
  • 棄用并刪除了形狀推理中的 attrs() 函數(shù),現(xiàn)在所有的屬性都應(yīng)該通過(guò)名字來(lái)查詢。
  • 以下 Python 符號(hào)是在 TensorFlow 的早期版本中意外添加的,現(xiàn)在已被刪除。每個(gè)符號(hào)都有一個(gè)替換項(xiàng),但請(qǐng)注意替換項(xiàng)的參數(shù)名稱是不同的:
      • tf.quantize_and_dequantize_v4(在 TensorFlow 2.4 中意外引入):改用 tf.quantization.quantize_and_dequantize_v2;
      • tf.batch_mat_mul_v3(在 TensorFlow 2.6 中意外引入):改用 tf.linalg.matmul;
      • tf.sparse_segment_sum_grad(在 TensorFlow 2.6 中意外引入):改用 tf.raw_ops.SparseSegmentSumGrad。

將 tensorflow::int64 重命名為 int_64_t(前者是后者的別名)。

模塊化文件系統(tǒng)的遷移:

對(duì) S3 和 HDFS 文件系統(tǒng)的支持已經(jīng)遷移到一個(gè)基于模塊化文件系統(tǒng)的方法,現(xiàn)在可以在 https://github.com/tensorflow/io 中使用。用戶需要安裝 tensorflow-io python 包,以支持 S3 和 HDFS。

TensorFlow 2.7 主要功能和改進(jìn)

對(duì) TensorFlow 調(diào)試經(jīng)驗(yàn)的改進(jìn):以前,TensorFlow 錯(cuò)誤堆棧跟蹤涉及許多內(nèi)部幀,讀出這些幀可能具有挑戰(zhàn)性,而且對(duì)最終用戶而言不可操作。從 TF 2.7 開始,TensorFlow 在它引發(fā)的大多數(shù)錯(cuò)誤中過(guò)濾內(nèi)部幀,以保持堆棧跟蹤簡(jiǎn)短、可讀,并專注于最終用戶可操作的內(nèi)容。

通過(guò)在每個(gè)異常中添加傳遞給該層的參數(shù)值的完整列表,提高由 Keras Layer.__call__()引發(fā)的錯(cuò)誤消息信息量。

tf.data:tf.data 服務(wù)現(xiàn)在支持自動(dòng)分片(auto-sharding)。用戶通過(guò) tf.data.experimental.service.ShardingPolicy 枚舉指定分片策略;tf.data.experimental.service.register_dataset 現(xiàn)在接受可選的 compression 參數(shù)。

Keras:tf.keras.layers.Conv 現(xiàn)在包含一個(gè)公共的 convolution_op 方法。此方法可用于簡(jiǎn)化 Conv 子類的實(shí)現(xiàn),有兩種方式使用這個(gè)新方法,第一種方法如下:

  1. class StandardizedConv2D(tf.keras.layers.Conv2D): 
  2.     def call(self, inputs): 
  3.       mean, var = tf.nn.moments(self.kernel, axes=[012], keepdims=True) 
  4.       return self.convolution_op(inputs, (self.kernel - mean) / tf.sqrt(var + 1e-10)) 

你也可以采用如下方法:

  1. class StandardizedConv2D(tf.keras.Layer): 
  2.     def convolution_op(self, inputs, kernel): 
  3.       mean, var = tf.nn.moments(kernel, axes=[012], keepdims=True) 
  4.       # Author code uses std + 1e-5 
  5.       return super().convolution_op(inputs, (kernel - mean) / tf.sqrt(var + 1e-10)) 
  • 向 tf.keras.metrics.Metric 添加了 merge_state() 方法以用于分布式計(jì)算;
  • 向 tf.keras.layers.TextVectorization 添加了 sparse 和 ragged 的選項(xiàng),以允許來(lái)自層的 SparseTensor 和 RaggedTensor 輸出。

tf.lite:添加 experimental API Experiment_from_jax 以支持從 Jax 模型到 TensorFlow Lite 的轉(zhuǎn)換;支持 uint32 數(shù)據(jù)類型;添加實(shí)驗(yàn)量化調(diào)試器 tf.lite.QuantizationDebugger。

更多詳情可查看:

https://github.com/tensorflow/tensorflow/releases/tag/v2.7.0

 

責(zé)任編輯:張燕妮 來(lái)源: 機(jī)器之心Pro
相關(guān)推薦

2018-04-15 21:49:29

開發(fā)者 TensorFlow谷歌

2021-09-12 13:23:38

微軟WSL機(jī)器學(xué)習(xí)

2019-01-11 14:32:09

TensorFlow 機(jī)器之心谷歌

2022-06-15 14:48:39

谷歌TensorFlowMeta

2021-07-13 08:43:00

GoogleTensorFlow AI

2019-12-04 09:54:03

深度學(xué)習(xí)編程人工智能

2010-07-05 09:50:29

PythonPython 2.7

2014-12-17 09:26:26

GoAndroid

2009-02-09 15:44:37

Chrome 1.0正下載

2013-02-28 09:33:58

DjangoPython

2022-02-08 15:47:44

TensorFlow功能新版

2010-04-01 10:16:32

Hibernate

2012-08-02 13:22:04

Chrome 21瀏覽器

2011-05-20 10:18:51

RHEL 6.1紅帽

2017-12-29 15:42:13

LinuxLite 3.8 Be正式版

2017-03-12 10:38:56

Chromewindows

2009-04-09 17:09:32

LinuxVirtualBox

2022-06-16 15:13:26

龍蜥操作系統(tǒng)自研操作系統(tǒng)

2012-04-14 20:44:14

PhoneGap

2019-09-04 09:26:42

谷歌Android開發(fā)者
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)