小编use*_*665的帖子

CMake 警告:无法为目标生成安全的链接器搜索路径

在为 pcl 项目运行 CMake 时,我收到一条警告消息:

-- Configuring done
CMake Warning at CMakeLists.txt:12 (add_executable):
  Cannot generate a safe linker search path for target
  handgenerator_output_to_pcd because files in some directories may conflict
  with libraries in implicit directories:

    link library [libboost_system.so] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /usr/local/lib
    link library [libboost_filesystem.so] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /usr/local/lib
    link library [libboost_thread.so] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /usr/local/lib
    link library [libboost_date_time.so] in /usr/lib/x86_64-linux-gnu may be hidden by …
Run Code Online (Sandbox Code Playgroud)

c++ linker cmake

6
推荐指数
0
解决办法
4387
查看次数

关于Theano中扁平化功能的澄清

在[ http://deeplearning.net/tutorial/lenet.html#lenet]中它说:

This will generate a matrix of shape (batch_size, nkerns[1] * 4 * 4),
# or (500, 50 * 4 * 4) = (500, 800) with the default values.
layer2_input = layer1.output.flatten(2)
Run Code Online (Sandbox Code Playgroud)

当我在numpy 3d数组上使用flatten函数时,我得到一维数组.但在这里它说我得到一个矩阵.flatten(2)如何在theano中运作?

numpy上的类似示例生成一维数组:

     a= array([[[ 1,  2,  3],
    [ 4,  5,  6],
    [ 7,  8,  9]],

   [[10, 11, 12],
    [13, 14, 15],
    [16, 17, 18]],

   [[19, 20, 21],
    [22, 23, 24],
    [25, 26, 27]]])

   a.flatten(2)=array([ 1, 10, 19,  4, 13, 22,  7, 16, 25,  2, 11, …
Run Code Online (Sandbox Code Playgroud)

numpy flatten theano conv-neural-network

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

用于编译 HDF5 的 CMakelists.txt?

我正在尝试编译一个简单的程序来读取 HDF5 文件。代码使用 h5c++ 正确编译。但是我需要一个相同的 cmakelists.txt

读取数据文件

#include <iostream>
#include "H5Cpp.h"
#ifndef H5_NO_NAMESPACE
    using namespace H5;
#endif
const H5std_string FILE_NAME( "testfile.h5" );

int main (void)
{
    H5File openFile( FILE_NAME, H5F_ACC_RDONLY );
}
Run Code Online (Sandbox Code Playgroud)

我为它尝试了一个 cmakelists 但它没有用。它给出了“未定义的错误”

readdata.cpp:(.text+0x1d): undefined reference to `H5::FileAccPropList::DEFAULT'
readdata.cpp:(.text+0x24): undefined reference to `H5::FileCreatPropList::DEFAULT'
readdata.cpp:(.text+0x38): undefined reference to `H5check_version'
readdata.cpp:(.text+0x54): undefined reference to `H5::H5File::H5File(std::__cxx11::basic_string<char,     std::char_traits<char>, std::allocator<char> > const&, unsigned int, H5::FileCreatPropList const&, H5::FileAccPropList const&)'
readdata.cpp:(.text+0x60): undefined reference to `H5::H5File::~H5File()'
Run Code Online (Sandbox Code Playgroud)

CMakelists.txt

cmake_minimum_required(VERSION 3.1.0) 
PROJECT (readhdf5)

find_package(HDF5 REQUIRED)
include_directories(${HDF5_INCLUDE_DIRS})

add_executable( readdata …
Run Code Online (Sandbox Code Playgroud)

c++ cmake hdf5 linker-errors

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

C++ 构造函数析构函数执行顺序差异

据我所知,调用析构函数的顺序与创建对象的顺序相反。

然而,在下面的代码中,我不明白为什么 C(1) 和 C(2) 的析构函数在其构造函数之后立即被调用。

另外,语句 C(2) 和 C c3(3) 之间有什么区别。第二个是一个用值 3 初始化的对象。C(2) 的解释是什么?

#include <iostream>

class C {
public:
  C(int i)
  {   j = i;
      std::cout << "constructor called for "<<j << std::endl;;
    }
  ~C()
  { std::cout << "destructor called for "<<j<< std::endl;; }

private:
  int j;
};

int main() {
  C(1);
  C(2);

  C c3(3);
  C c4(4);
}
Run Code Online (Sandbox Code Playgroud)

代码的输出是:

constructor called for 1
destructor called for 1
constructor called for 2
destructor called for 2
constructor called for …
Run Code Online (Sandbox Code Playgroud)

c++ destructor

0
推荐指数
1
解决办法
63
查看次数