当前位置: 首页>>代码示例>>C++>>正文


C++ BlobShape::add_dim方法代码示例

本文整理汇总了C++中BlobShape::add_dim方法的典型用法代码示例。如果您正苦于以下问题:C++ BlobShape::add_dim方法的具体用法?C++ BlobShape::add_dim怎么用?C++ BlobShape::add_dim使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BlobShape的用法示例。


在下文中一共展示了BlobShape::add_dim方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: layer

TYPED_TEST(ReshapeLayerTest, TestForwardAfterReshape) {
  typedef typename TypeParam::Dtype Dtype;
  LayerParameter layer_param;
  BlobShape* shape = layer_param.mutable_reshape_param()->mutable_shape();
  shape->add_dim(6);
  shape->add_dim(2);
  shape->add_dim(3);
  shape->add_dim(5);
  ReshapeLayer<Dtype> layer(layer_param);
  layer.SetUp(this->blob_bottom_vec_, this->blob_top_vec_);
  layer.Forward(this->blob_bottom_vec_, this->blob_top_vec_);
  // We know the above produced the correct result from TestForward.
  // Reshape the bottom and call layer.Reshape, then try again.
  vector<int> new_bottom_shape(1, 2 * 3 * 6 * 5);
  this->blob_bottom_->Reshape(new_bottom_shape);
  layer.Reshape(this->blob_bottom_vec_, this->blob_top_vec_);
  FillerParameter filler_param;
  GaussianFiller<Dtype> filler(filler_param);
  filler.Fill(this->blob_bottom_);
  layer.Forward(this->blob_bottom_vec_, this->blob_top_vec_);
  for (int i = 0; i < this->blob_bottom_->count(); ++i) {
    EXPECT_EQ(this->blob_top_->cpu_data()[i],
              this->blob_bottom_->cpu_data()[i]);
  }
}
开发者ID:hanshizhong1105,项目名称:caffe-sc,代码行数:25,代码来源:test_reshape_layer.cpp

示例2:

BlobShape ModelServer<DType>::blob_shape_by_name(string name) {
  const vector<int>& shape = solver->net()->blob_by_name(name)->shape();
  BlobShape ret;
  for (uint32_t i = 0; i < shape.size(); ++i) {
    ret.add_dim(shape[i]);
  }
  return ret;
}
开发者ID:0hm,项目名称:caffe,代码行数:8,代码来源:ModelServer.cpp

示例3: SetUp

  virtual void SetUp() {
    BlobShape shape;
    shape.add_dim(1);  // Batch
    shape.add_dim(8);  // Channels
    shape.add_dim(4);  // Depth
    shape.add_dim(4);  // Height
    shape.add_dim(4);  // Width
    blob_bottom_->Reshape(shape);

    shape.add_dim(1);  // Batch
    shape.add_dim(8);  // Channels
    shape.add_dim(2);  // Depth
    shape.add_dim(2);  // Height
    shape.add_dim(2);  // Width
    blob_top_->Reshape(shape);

    // fill the values
    blob_bottom_vec_.push_back(blob_bottom_);
    blob_top_vec_.push_back(blob_top_);
  }
开发者ID:ifp-uiuc,项目名称:caffe,代码行数:20,代码来源:test_pooling_nd_layer.cpp


注:本文中的BlobShape::add_dim方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。