我正在尝试在v2.0中运行一个tensorflow代码,并且遇到以下错误
AttributeError: module 'tensorflow' has no attribute 'logging'
Run Code Online (Sandbox Code Playgroud)
我不想简单地将其从代码中删除。
我的张量流代码中收到以下弃用警告:
不推荐使用名称tf.Session。请改用tf.compat.v1.Session。
tf.sessiontf.compat.v1.Session我正在尝试编写简单的c ++代码来读写文件.问题是我的输出文件小于原始文件,我找不到原因.我有一个6.6 kb的图像,我的输出图像大约6.4 kb
#include <iostream>
#include <fstream>
using namespace std;
ofstream myOutpue;
ifstream mySource;
int main()
{
mySource.open("im1.jpg", ios_base::binary);
myOutpue.open("im2.jpg", ios_base::out);
char buffer;
if (mySource.is_open())
{
while (!mySource.eof())
{
mySource >> buffer;
myOutpue << buffer;
}
}
mySource.close();
myOutpue.close();
return 1;
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试编写一个c ++代码来读取文件并将其编码为(1/0)二进制文件,然后从(1/0)文件中获取原始文件.我必须从其他计算机中的1/0二进制文件重建原始文件,因此1/0以及如何重建它对我来说非常重要.
原因是,我的输出文件小于原始文件.例如,如果我有一个6.6 kb的jpeg图像,重建的文件大约是6.4 kb.
#include <iostream>
#include <fstream>
#include <bitset>
using namespace std;
ofstream myOutput;
ifstream mySource;
int main()
{
mySource.open("im1.jpg", ios_base::binary);
myOutput.open("im2.jpg", ios_base::binary);
unsigned char buffer;
unsigned char recBuffer;
unsigned int ascii;
if (mySource.is_open())
{
while (!mySource.eof())
{
// code
mySource >> buffer;
ascii = static_cast<unsigned int>(buffer);
cout<< bitset<8>(ascii) << endl;
// reconstruction
recBuffer = static_cast<char>(ascii);
myOutput << recBuffer;
}
}
mySource.close();
myOutput.close();
return 1;
}
Run Code Online (Sandbox Code Playgroud)