当前位置: 首页 > wzjs >正文

做推广赚钱的网站有哪些网页前端做购物网站的实训报告

做推广赚钱的网站有哪些,网页前端做购物网站的实训报告,哪些网站可以做百科参考资料,广东在线网站建设目录 前言示例示例1示例2示例3示例4 前言 TensorFlow 的 tf.data.Dataset API 提供了一种灵活且高效的方式来加载和预处理数据。它可以轻松处理大规模数据集,并支持多种数据源格式。 所有数据集相关的内容都在tf.data中,from_tensor_slices:…

目录

  • 前言
  • 示例
    • 示例1
    • 示例2
    • 示例3
    • 示例4

前言

TensorFlow 的 tf.data.Dataset API 提供了一种灵活且高效的方式来加载和预处理数据。它可以轻松处理大规模数据集,并支持多种数据源格式。 所有数据集相关的内容都在tf.data中,from_tensor_slices:可以从元组, 列表, 字典, ndarray中创建dataset。

示例

示例1

import tensorflow as tf
import numpy as npdataset = tf.data.Dataset.from_tensor_slices(np.arange(10))  
print (dataset)# 数据集最基础的用法就是取数据
for item in dataset:print(item)

结果如下:

<TensorSliceDataset shapes: (), types: tf.int32>
tf.Tensor(0, shape=(), dtype=int32)
tf.Tensor(1, shape=(), dtype=int32)
tf.Tensor(2, shape=(), dtype=int32)
tf.Tensor(3, shape=(), dtype=int32)
tf.Tensor(4, shape=(), dtype=int32)
tf.Tensor(5, shape=(), dtype=int32)
tf.Tensor(6, shape=(), dtype=int32)
tf.Tensor(7, shape=(), dtype=int32)
tf.Tensor(8, shape=(), dtype=int32)
tf.Tensor(9, shape=(), dtype=int32)

示例2

import tensorflow as tf
import numpy as np# 从元组创建dataset, (x,y)
x = np.array([[1, 2], [3, 4], [5, 6]])
y = np.array(['cat', 'dog', 'fox'])
dataset = tf.data.Dataset.from_tensor_slices((x, y))
for item_x, item_y in dataset:print(item_x.numpy(), item_y.numpy().decode())

结果如下

[1 2] b'cat'
[3 4] b'dog'
[5 6] b'fox'

示例3

import tensorflow as tf
import numpy as np# 从元组创建dataset, (x,y)
x = np.array([[1, 2], [3, 4], [5, 6]])
y = np.array(['cat', 'dog', 'fox'])
dataset = tf.data.Dataset.from_tensor_slices({'feature': x,'label': y
})
for item in dataset:print(item['feature'].numpy(), item['label'].numpy())

结果如下

[1 2] b'cat'
[3 4] b'dog'
[5 6] b'fox'

示例4

import tensorflow as tf
import numpy as np# interleave
# 最常见用法 : 文件名dataset  --> 具体数据集
dataset = tf.data.Dataset.from_tensor_slices(np.arange(10))
dataset = dataset.repeat(3).batch(7)
# map_fn, cycle_length 并行长度, block_length 
dataset = dataset.interleave(lambda v: tf.data.Dataset.from_tensor_slices(v),cycle_length = 5,block_length = 5
)
for item in dataset:print(item)

结果如下

tf.Tensor(0, shape=(), dtype=int32)
tf.Tensor(1, shape=(), dtype=int32)
tf.Tensor(2, shape=(), dtype=int32)
tf.Tensor(3, shape=(), dtype=int32)
tf.Tensor(4, shape=(), dtype=int32)
tf.Tensor(7, shape=(), dtype=int32)
tf.Tensor(8, shape=(), dtype=int32)
tf.Tensor(9, shape=(), dtype=int32)
tf.Tensor(0, shape=(), dtype=int32)
tf.Tensor(1, shape=(), dtype=int32)
tf.Tensor(4, shape=(), dtype=int32)
tf.Tensor(5, shape=(), dtype=int32)
tf.Tensor(6, shape=(), dtype=int32)
tf.Tensor(7, shape=(), dtype=int32)
tf.Tensor(8, shape=(), dtype=int32)
tf.Tensor(1, shape=(), dtype=int32)
tf.Tensor(2, shape=(), dtype=int32)
tf.Tensor(3, shape=(), dtype=int32)
tf.Tensor(4, shape=(), dtype=int32)
tf.Tensor(5, shape=(), dtype=int32)
tf.Tensor(8, shape=(), dtype=int32)
tf.Tensor(9, shape=(), dtype=int32)
tf.Tensor(5, shape=(), dtype=int32)
tf.Tensor(6, shape=(), dtype=int32)
tf.Tensor(2, shape=(), dtype=int32)
tf.Tensor(3, shape=(), dtype=int32)
tf.Tensor(9, shape=(), dtype=int32)
tf.Tensor(0, shape=(), dtype=int32)
tf.Tensor(6, shape=(), dtype=int32)
tf.Tensor(7, shape=(), dtype=int32)
http://www.dtcms.com/wzjs/842091.html

相关文章:

  • 建设工程协会网站查询系统wordpress 登录空白
  • shopex 如何看 网站后台营销型网站建站要素
  • 三门峡住房城乡建设局网站景德镇企业网站建设
  • 外贸网站的推广技巧有哪些wordpress 论坛 小程序
  • 湘潭做网站问下磐石网络如何增加网站流量
  • wordpress仿站抓取软件教育学校网站源码 php
  • 网站建设的重点是什么wordpress 提交熊掌
  • 网站建设与维护题库企业网站推广哪家公司好
  • 温州公司网址公司网站关键词优化建议
  • 网站开发方法有哪些网站建设产品培训
  • 简洁的网站地图模板wordpress密码加密
  • 揭阳 网站建设网站建设报价单范本
  • 莱芜网站建设服务小程序源码什么意思
  • 外贸网站域名赏析外贸网站谷歌推广
  • 网站营销推广如何做百度下载安装app
  • 制作企业网站新闻列表页面网页设计实训报告做网站 融资
  • 河南住房和城乡建设厅网官方网站各大企业网站文案
  • 高端上海网站设计公司网上简历模板
  • 销售网站代注册公司一般多少钱
  • 旅游网站建设的背景网站建设公司怎么开
  • 哈密地网站建设asp商业网站源码
  • 唐山网站专业制作wordpress 收费吗
  • 做个类似淘宝的网站怎么做深圳市工程建设网站
  • 渝水区城乡建设局网站建筑设计专业的网站
  • 安徽方圆建设有限公司网站网站如何收录
  • 对网站二次开发的认识做网站的详细教程
  • 竞拍网站做烂了网页设计的目的与要求
  • 下载素材的网站团购网站 如何做推广
  • 垂直型跨境电商平台seo短视频新地址在哪里
  • 怎样优化自己的网站深圳网页制作招聘网