小编Had*_*ekh的帖子

模块'tensorflow'没有属性'logging'

我正在尝试在v2.0中运行一个tensorflow代码,并且遇到以下错误

AttributeError: module 'tensorflow' has no attribute 'logging'
Run Code Online (Sandbox Code Playgroud)

我不想简单地将其从代码中删除。

  • 为什么此代码已被删除?
  • 为什么我应该改为呢?

tensorflow tensorflow2.0

11
推荐指数
2
解决办法
7555
查看次数

不推荐使用名称tf.Session。请改用tf.compat.v1.Session

我的张量流代码中收到以下弃用警告:

不推荐使用名称tf.Session。请改用tf.compat.v1.Session。

  • 为什么我收到此警告
  • 在Tensorflow 2.0中将会发生什么。代替tf.session
  • 可以使用吗 tf.compat.v1.Session

tensorflow tensorflow2.0

8
推荐指数
1
解决办法
1万
查看次数

使用fstream以c ++读写二进制文件

我正在尝试编写简单的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++ fstream ifstream ofstream

3
推荐指数
1
解决办法
5065
查看次数

将文件编码为1/0二进制文件,并用c ++重建原始文件

我正在尝试编写一个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)

c++ binary fstream file

2
推荐指数
1
解决办法
181
查看次数

标签 统计

c++ ×2

fstream ×2

tensorflow ×2

tensorflow2.0 ×2

binary ×1

file ×1

ifstream ×1

ofstream ×1