摘要: 1. tf.global_variables_initializer() 可以初始化所有变量。 2. tf.variables_initializer([var_list]) 仅初始化列表var_list种的值。 报错结果: 正确结果: 3. 变量重复赋值并未报错,其结果如下: 此点证实模型参数可以 阅读全文
posted @ 2019-10-15 22:59 tangjunjun 阅读(1525) 评论(0) 推荐(0) 编辑
摘要: 类是c++重要核心之一,也是有别于c语言标志之一。对于初学者可能会为此头疼,看了很多博客等网上讲解,也不知所云。为此,我将在这里针对类所有变化进行解释。 介绍类之前,我先简单提及一下结构体,大家都知道c语言没有类,但却有结构体,其编辑代码如下: #include "stdafx.h" #includ 阅读全文
posted @ 2019-10-15 11:37 tangjunjun 阅读(1324) 评论(0) 推荐(0) 编辑
摘要: 类中友元函数则是为了访问私有变量,如类B需要访问类A中的私有变量,则代码如下: example one: #include "stdafx.h"#includeusing namespace std;class B; //提前申明类Bclass A{public: A(){ English=19; 阅读全文
posted @ 2019-10-15 11:36 tangjunjun 阅读(239) 评论(0) 推荐(0) 编辑
摘要: 类的静态类型处理,可以避免全局变量使用.......请看如下代码: #include "stdafx.h" #include using namespace std; class STATIC_A{ public: STATIC_A (); //构造函数 ~STATIC_A (){}; //析构函数 阅读全文
posted @ 2019-10-15 11:35 tangjunjun 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 类中静态成员函数一般对静态成员调用 ,而要调用其非静态成员时,则类似于函数形参引用类一样(然其有一种情形,即不建立类对象,亦可引用静态成员函数,如:STATIC_A::disp( );),其代码如下: #include "stdafx.h" #include using namespace std; 阅读全文
posted @ 2019-10-15 11:35 tangjunjun 阅读(998) 评论(0) 推荐(0) 编辑
摘要: 此代码将类A简单嵌套类B中,其代码如下: #include "stdafx.h" #include using namespace std; class A{ public: A(){ English=100; }; ~A(){ delete []name; }; void Name (char * 阅读全文
posted @ 2019-10-15 11:35 tangjunjun 阅读(89) 评论(0) 推荐(0) 编辑
摘要: 类的继承有三种方式,其一为公有继承/其二为私有继承/其三为保护集成。其继承原理大致如下代码: class A{ public: //公有成员 private://私有成员 product: //保护成员 };//建立一个基类,即继承的类 1.公有继承: class B:public A{ };//以 阅读全文
posted @ 2019-10-15 11:34 tangjunjun 阅读(1409) 评论(0) 推荐(0) 编辑
摘要: 有继承情形下 基类与子类的构造函数与析构函数运行顺序,如下代码: #include "stdafx.h" #include using namespace std; class A { public: A() { cout << "Base class constructor" << endl; } 阅读全文
posted @ 2019-10-15 11:32 tangjunjun 阅读(367) 评论(0) 推荐(0) 编辑
摘要: 我们知道c语言中可以整型数据或浮点型等做四则运算,而自己写的类也可做四则运算,是不是感觉奇怪,可以看以下代码是如何完成类之间的四则运算: #include "stdafx.h" #include using namespace std; class A { public: A(double r1=0 阅读全文
posted @ 2019-10-15 11:31 tangjunjun 阅读(315) 评论(0) 推荐(0) 编辑
摘要: 我在微博中已经提到继承的方式有三种(公有继承、私有继承、保护继承),然私有继承会将基类的公有成员变成私有成员。如果,我们想通过外部访问基类中的成员,则无法实现,原因在于私有继承将基类中的公有成员变成了私有成员。为此,我们将想办法将子类中私有成员(基类的公有成员)变成子类公有成员,则需用到“::”此符 阅读全文
posted @ 2019-10-15 11:31 tangjunjun 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 类模板 #include "stdafx.h" #include using namespace std; template class A { public: A(double r1,double i1) { r = r1; i = i1; } //simple print(); simple p 阅读全文
posted @ 2019-10-15 11:29 tangjunjun 阅读(101) 评论(0) 推荐(0) 编辑
摘要: #include "stdafx.h" #include using namespace std; int _tmain(int argc, _TCHAR* argv[]) { int b=1; switch (b+2){ case 1 : { cout<<"b="<<b<<endl;} case 阅读全文
posted @ 2019-10-15 11:28 tangjunjun 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 精确算法(Exact algorithm)指可求出最优解的算法。到目前为止,已提出的精确算法种类较多,有分支定界法、割平面法、整数规划算法和动态规划算法等。一般可用软体为 CPLEX LINGO GUROBI 启发式策略(heuristic)是一类在求解某个具体问题时,在可以接受的时间和空间内能给出 阅读全文
posted @ 2019-10-15 11:28 tangjunjun 阅读(4332) 评论(0) 推荐(0) 编辑
摘要: int b=8; int c=0; c=++b; cout<<"c="<<c<<endl; cout<<"b="<<b<<endl; 结果为:c=9;b=9; int b=8; int c=0; c=b++; cout<<"c="<<c<<endl; cout<<"b="<<b<<endl; 结果为 阅读全文
posted @ 2019-10-15 11:26 tangjunjun 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 指针的一些总结 const与指针 指向const的指针指的是指针指向的数据是常量,不可以被修改,但指针变量本身可以被修改,如const int *p;严格说不能用指针间接修改指向的数据,但该变量可以通过自己本省修改。如 int a=10; const int *p=&a;则*p=9是错误的,无法被修 阅读全文
posted @ 2019-10-15 11:25 tangjunjun 阅读(237) 评论(0) 推荐(0) 编辑
摘要: #include "stdafx.h" #include using namespace std; int _tmain(int argc, _TCHAR* argv[]) { char buffer[134]; cin>>buffer; int len=(int) strlen(buffer);/ 阅读全文
posted @ 2019-10-15 11:25 tangjunjun 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 头文件格式 主要声明,如函数,变量等 源文件说明头文件声明的定义 头文件与源文件总体框架与架构 头文件与源文件总体框架与架构 阅读全文
posted @ 2019-10-15 11:24 tangjunjun 阅读(357) 评论(0) 推荐(0) 编辑
摘要: 变量a会从运行的程序上叠加,因此输出a++的值为9,10,11,12,13,14等 #include "stdafx.h" #include using namespace std; int A(){ static int a=9; //去掉static 程序将会不一样 cout<< a++<<en 阅读全文
posted @ 2019-10-15 11:23 tangjunjun 阅读(798) 评论(0) 推荐(0) 编辑
摘要: 默认参数 即使申明是用的,如function(int a,int b=4);此时就默认变量b的参数为4,调用函数时候可用function(5)。默认参数要在形参尾部。 指针参数 引用参数 函数声明与定义 int function(int &a,int &b){}; 函数调用 int d=5,e=9; 阅读全文
posted @ 2019-10-15 11:23 tangjunjun 阅读(187) 评论(0) 推荐(0) 编辑
摘要: C语言中的回调函数(Callback Function) 1 定义和使用场合 回调函数是指 使用者自己定义一个函数,实现这个函数的程序内容,然后把这个函数(入口地址)作为参数传入别人(或系统)的函数中,由别人(或系统)的函数在运行时来调用的函数。函数是你实现的,但由别人(或系统)的函数在运行时通过参 阅读全文
posted @ 2019-10-15 11:22 tangjunjun 阅读(266) 评论(0) 推荐(0) 编辑
https://rpc.cnblogs.com/metaweblog/tangjunjun