本文整理汇总了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]);
}
}
示例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;
}
示例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_);
}