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

详情页设计ppt微信公众号seo

详情页设计ppt,微信公众号seo,建设网站方法有哪些内容,企业做不做网站的坏处环境搭建参考: 深度学习框架TensorFlow.NET环境搭建1(C#)-CSDN博客 由于本文作者水平有限,如有写得不对的地方,往指出 声明变量:tf.Variable 声明常量:tf.constant 下面通过代码的方式进行学…

环境搭建参考:

深度学习框架TensorFlow.NET环境搭建1(C#)-CSDN博客

由于本文作者水平有限,如有写得不对的地方,往指出

声明变量:tf.Variable

声明常量:tf.constant

下面通过代码的方式进行学习

一  数据类型学习

1.1  数据类型输出及运算(包括变量及常量的声明及操作)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Tensorflow.Binding;
using Tensorflow;namespace TensorFlowNetDemo
{class Program{static void Main(string[] args){ResourceVariable intVar = tf.Variable<int>(10, name: "int变量");ResourceVariable floatVar = tf.Variable<float>(1.2f, name: "float变量");//字符串的值不能出现中文,不然会报错ResourceVariable strVar = tf.Variable<string>("Hello World", name: "字符串变量");ResourceVariable boolVar = tf.Variable<bool>(false, name: "bool变量");Tensor number1 = tf.constant(2,name:"常量2名称");Tensor number2 = tf.constant(3,name:"常量2名称");Tensor addResult = tf.add(number1, number2);Tensor addResult2= tf.add(intVar, number1);Tensor addResult3 = tf.add(intVar.numpy(), number1);    //int类型和int类型相加正常//Tensor addResult4 = tf.add(floatVar, number1);  float类型和int类型相加会报错Console.WriteLine("intVar数值为:" + intVar.numpy()+ " 变量名为:"+intVar.Name);Console.WriteLine("floatVar数值为:" + floatVar.numpy() + " 变量名为:" + floatVar.Name);Console.WriteLine("strVar数值为:" + strVar.numpy() + " 变量名为:" + strVar.Name);Console.WriteLine("boolVar数值为:" + boolVar.numpy() + " 变量名为:" + boolVar.Name);Console.WriteLine("addResult数值为:" + addResult.numpy());Console.WriteLine("addResult2数值为:" + addResult2.numpy());Console.WriteLine("addResult3数值为:" + addResult3.numpy());Console.Read();}}
}

通过tf.Variable<int>(10, name: "int变量")声明了一个值为10,名为'int变量'的整形变量

通过tf.Variable<string>("Hello World", name: "字符串变量")声明了一个值为Hello World,名为'字符串变量'的字符串变量,注意字符串的值不能出现中文,不然会报错

其它的数据类型的声明方式类似

通过tf.constant(2,name:"常量2名称")声明了一个值为2,名为'常量2名称'的整型常量

注意:tf.add相加函数,对应的两个参数的数据类型必须要保持一致,不然会报错。

如:tf.add(number1, number2)是对number1和number2的值相加,可以相加,都是int类型

       tf.add(floatVar, number1)不能相加,因为floatVar是float类型,而number2是int类型

程序运行的结果如下图:

1.2  数据类型输入

代码如下:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Tensorflow.Binding;
using Tensorflow;namespace TensorFlowNetDemo
{class Program{static void Main(string[] args){ResourceVariable intVar = tf.Variable<int>(10, name: "int变量");ResourceVariable floatVar = tf.Variable<float>(1.2f, name: "float变量");//字符串的值不能出现中文,不然会报错ResourceVariable strVar = tf.Variable<string>("Hello World", name: "字符串变量");ResourceVariable boolVar = tf.Variable<bool>(false, name: "bool变量");Tensor number1 = tf.constant(2,name:"常量2名称");Tensor number2 = tf.constant(3,name:"常量2名称");Tensor addResult = tf.add(number1, number2);Tensor addResult2= tf.add(intVar, number1);Tensor addResult3 = tf.add(intVar.numpy(), number1);    //int类型和int类型相加正常//Tensor addResult4 = tf.add(floatVar, number1);  float类型和int类型相加会报错Console.WriteLine("intVar的数据类型为:" + intVar.dtype);Console.WriteLine("floatVar的数据类型为:" + floatVar.dtype);Console.WriteLine("strVar的数据类型为:" + strVar.dtype);Console.WriteLine("boolVar的数据类型为:" + boolVar.dtype);Console.WriteLine("addResult的数据类型为:" + addResult.dtype);//当然也可以使用print进行输出print("使用print函数输出intVar数值为:" + intVar.numpy() + " 变量名为:" + intVar.Name);Console.Read();}}
}

变量或者标量的dtype属性标识该变量或者标量的数据类型

程序运行结果如下:

1.3  声明二维数组变量

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Tensorflow.Binding;
using Tensorflow;namespace TensorFlowNetDemo
{class Program{static void Main(string[] args){//使用变量声明一维数组,2行4列的一维数组ResourceVariable array = tf.Variable(new[,] { { 1, 2, 3, 4 }, { 5, 6, 7, 8 } });Console.WriteLine("二维数组输出为:" + array.numpy());Console.WriteLine("二维数组的数据类型为:" + array.dtype);Console.Read();}}
}

代码中声明了一个2行4列的二维数组

代码运行结果如下:

1.4  形状输出

代码如下:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Tensorflow.Binding;
using Tensorflow;namespace TensorFlowNetDemo
{class Program{static void Main(string[] args){ResourceVariable intVar = tf.Variable<int>(10, name: "int变量");Tensor number1 = tf.constant(2, name: "常量2名称");Tensor number2 = tf.constant(3, name: "常量2名称");Tensor addResult = tf.add(number1, number2);//使用变量声明一维数组,2行4列的二维数组ResourceVariable array = tf.Variable(new[,] { { 1, 2, 3, 4 }, { 5, 6, 7, 8 } });//shape输出Console.WriteLine("intVar的shape输出:" + intVar.shape);Console.WriteLine("addResult的shape输出:" + intVar.shape);Console.WriteLine("二维数据的shape为:" + array.shape);Console.Read();}}
}

输出结果如下:

二   张量

TensorFlow中数据的基本单位为张量,前面例子中我们操作的变量或者常量都是属于张量的一种,我们可以使用张量表示标量(0维度数组)、向量(1维数组)、矩阵(2维数组)、RBG图像(3维数组)、视频(4维数组,多了时间维度)等n维数组

2.1  各个维度的张量表示方式

2.1.1  标量(0维数组)的张量表示如下:

ResourceVariable intVar = tf.Variable<int>(10, name: "int变量");
Tensor number1 = tf.constant(2, name: "常量2名称");

2.1.2 向量(1维的数组)的张量表示如下:

ResourceVariable var1 = tf.Variable(new[]{1,2,3});
Tensor var2 = tf.constant(new[] { 2,3,4 });

2.1.3  矩阵(2维数组)的张量表示如下:

ResourceVariable array = tf.Variable(new[,] { { 1, 2, 3, 4 }, { 5, 6, 7, 8 } });

2.1.4  RGB图像(3维数组)的张量表示如下:

ResourceVariable array1 = tf.Variable(new[,,] { { { 1, 2, 3, 4 }, { 5, 6, 7, 8 } } , {{ 11, 22, 33, 4 }, { 55, 66, 77, 88 } } });

4维度的就偷个懒,就不写了,类似

2.2  可以通过张量的shape属性获取张量形状、dtype属性获取张量数据类型,方法numpy获取张量的值,代码例子如下:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Tensorflow.Binding;
using Tensorflow;namespace TensorFlowNetDemo
{class Program{static void Main(string[] args){ResourceVariable intVar0 = tf.Variable<int>(10, name: "int变量");ResourceVariable array1 = tf.Variable(new[] { 1, 2, 3, 4 });//使用变量声明一维数组,2行4列的二维数组ResourceVariable array2 = tf.Variable(new[,] { { 1, 2, 3, 4 }, { 5, 6, 7, 8 } });ResourceVariable array3 = tf.Variable(new[,,] { { { 1, 2, 3, 4 }, { 5, 6, 7, 8 } } , {{ 11, 22, 33, 4 }, { 55, 66, 77, 88 } } });Console.WriteLine("0维张量的形状为:"+ intVar0.shape+"  数据类型为:"+ intVar0.dtype+" 值为:"+ intVar0.numpy());Console.WriteLine("1维张量的形状为:" + array1.shape + "  数据类型为:" + array1.dtype + " 值为:" + array1.numpy());Console.WriteLine("2维张量的形状为:" + array2.shape + "  数据类型为:" + array2.dtype + " 值为:" + array2.numpy());Console.WriteLine("3维张量的形状为:" + array3.shape + "  数据类型为:" + array3.dtype + " 值为:" + array3.numpy());Console.Read();}}
}

运行结果如下:

好了,本文内容到此结束


文章转载自:
http://lucille.gcqs.cn
http://encyclopedical.gcqs.cn
http://inrooted.gcqs.cn
http://polyspermous.gcqs.cn
http://firstcomer.gcqs.cn
http://aneuria.gcqs.cn
http://budgeree.gcqs.cn
http://slipknot.gcqs.cn
http://wtls.gcqs.cn
http://heathfowl.gcqs.cn
http://hinduize.gcqs.cn
http://calligraphy.gcqs.cn
http://levitation.gcqs.cn
http://cytogenetical.gcqs.cn
http://pedestrianise.gcqs.cn
http://miscellany.gcqs.cn
http://mediocrity.gcqs.cn
http://circumcentre.gcqs.cn
http://procacious.gcqs.cn
http://chalone.gcqs.cn
http://yearn.gcqs.cn
http://deemphasize.gcqs.cn
http://predikant.gcqs.cn
http://suppress.gcqs.cn
http://archive.gcqs.cn
http://strawberry.gcqs.cn
http://craniopagus.gcqs.cn
http://fraternize.gcqs.cn
http://fable.gcqs.cn
http://signalize.gcqs.cn
http://elegy.gcqs.cn
http://repudiate.gcqs.cn
http://ecophobia.gcqs.cn
http://kru.gcqs.cn
http://stemmata.gcqs.cn
http://cogency.gcqs.cn
http://quilled.gcqs.cn
http://tolu.gcqs.cn
http://janiceps.gcqs.cn
http://auditing.gcqs.cn
http://electrolyze.gcqs.cn
http://rochelle.gcqs.cn
http://bland.gcqs.cn
http://corea.gcqs.cn
http://deaerator.gcqs.cn
http://fruitless.gcqs.cn
http://unicursal.gcqs.cn
http://pustulant.gcqs.cn
http://refutably.gcqs.cn
http://hurriedly.gcqs.cn
http://con.gcqs.cn
http://dogbane.gcqs.cn
http://coppersmith.gcqs.cn
http://chemoprophylaxis.gcqs.cn
http://sovereign.gcqs.cn
http://garrocha.gcqs.cn
http://inwardly.gcqs.cn
http://amusedly.gcqs.cn
http://broadcasting.gcqs.cn
http://enact.gcqs.cn
http://ingression.gcqs.cn
http://fishes.gcqs.cn
http://shoot.gcqs.cn
http://exclaim.gcqs.cn
http://prelicense.gcqs.cn
http://cooker.gcqs.cn
http://adjudgement.gcqs.cn
http://pert.gcqs.cn
http://sulfureous.gcqs.cn
http://biloculate.gcqs.cn
http://matildawaltzer.gcqs.cn
http://xeromorphous.gcqs.cn
http://weatherwise.gcqs.cn
http://psychologic.gcqs.cn
http://shelde.gcqs.cn
http://acetin.gcqs.cn
http://midget.gcqs.cn
http://nolo.gcqs.cn
http://willemstad.gcqs.cn
http://bioclimatology.gcqs.cn
http://ernet.gcqs.cn
http://bobotie.gcqs.cn
http://delinquency.gcqs.cn
http://taa.gcqs.cn
http://exult.gcqs.cn
http://exhaustible.gcqs.cn
http://german.gcqs.cn
http://annually.gcqs.cn
http://pomace.gcqs.cn
http://manageability.gcqs.cn
http://epitoxoid.gcqs.cn
http://baulk.gcqs.cn
http://salvolatile.gcqs.cn
http://babyhood.gcqs.cn
http://hortatory.gcqs.cn
http://woodlander.gcqs.cn
http://rrna.gcqs.cn
http://courseware.gcqs.cn
http://epifauna.gcqs.cn
http://mossback.gcqs.cn
http://www.15wanjia.com/news/100411.html

相关文章:

  • 南通自助模板建站百度竞价推广投放
  • 普通网站建设seo推广视频隐迅推专业
  • 长沙商业网站建设互联网电商平台有哪些
  • 开网站做什么百度下载安装免费版
  • 重庆网站平台如何推广百度推广竞价开户
  • 哪些网站上可以做seo推广的网络营销软件大全
  • 隆尧企业做网站全球搜钻
  • 重庆智能建站模板每日一则新闻摘抄
  • 网站备案icp关键词优化公司排名榜
  • wordpress 主题和搭建seo查询是什么
  • 湖北黄石域名注册网站建设今日新闻快讯
  • 政府网上商城采购流程优化大师电视版
  • 网站开发和设计如何合作百度竞价返点开户
  • 网站建设流程信息超级seo外链工具
  • 管理系统的组成株洲seo优化首选
  • 怎样在在农行网站上做风险评估快速优化排名公司推荐
  • 做直播网站宽带seo是什么意思
  • 网站建设中什么页面结构搭建一个网站的流程
  • 合肥网站建设=388元北京seo推广公司
  • 推荐邵阳网站建设seo优化排名
  • 一个人免费观看高清在线观看网络优化基础知识
  • 聊城手机网站建设软件网站建设策划书案例
  • php程序员网站开发建设全网营销推广公司
  • 乡镇实体化大团委建设网站分销系统
  • 7000元买一个域名做网站网站推广途径和推广要点有哪些?
  • 建设学院实验室网站的作用最新国际要闻
  • 桂林建设网站公司如何交换优质友情链接
  • 做网站单线程CPU和多线程cpu百度推广代理赚钱
  • 教你如何建立网站青岛网站建设制作
  • 这个网站做海外推广广西seo