|
| Blob () |
|
| Blob (bool use_cuda_host_malloc) |
|
| Blob (const int num, const int channels, const int height, const int width, const bool use_cuda_host_malloc=false) |
| Deprecated; use Blob(const std::vector<int>& shape) .
|
|
| Blob (const std::vector< int > &shape, const bool use_cuda_host_malloc=false) |
|
| Blob (const Blob &)=delete |
|
void | operator= (const Blob &)=delete |
|
void | Reshape (const int num, const int channels, const int height, const int width) |
| Deprecated; use Reshape(const std::vector<int>& shape) .
|
|
void | Reshape (const std::vector< int > &shape) |
| Change the dimensions of the blob, allocating new memory if necessary.
|
|
void | ReshapeLike (const Blob &other) |
|
std::string | shape_string () const |
|
const std::vector< int > & | shape () const |
|
int | shape (int index) const |
| Returns the dimension of the index-th axis (or the negative index-th axis from the end, if index is negative).
|
|
int | num_axes () const |
|
int | count () const |
|
int | count (int start_axis, int end_axis) const |
| Compute the volume of a slice; i.e., the product of dimensions among a range of axes.
|
|
int | count (int start_axis) const |
| Compute the volume of a slice spanning from a particular first axis to the final axis.
|
|
int | CanonicalAxisIndex (int axis_index) const |
| create RoI Blob.
|
|
int | num () const |
| Deprecated legacy shape accessor num: use shape(0) instead.
|
|
int | channels () const |
| Deprecated legacy shape accessor channels: use shape(1) instead.
|
|
int | height () const |
| Deprecated legacy shape accessor height: use shape(2) instead.
|
|
int | width () const |
| Deprecated legacy shape accessor width: use shape(3) instead.
|
|
int | LegacyShape (int index) const |
|
int | offset (const int n, const int c=0, const int h=0, const int w=0) const |
|
int | offset (const std::vector< int > &indices) const |
|
void | CopyFrom (const Blob< Dtype > &source, bool reshape=false) |
| Copy from a source Blob.
|
|
Dtype | data_at (const int n, const int c, const int h, const int w) const |
|
Dtype | data_at (const std::vector< int > &index) const |
|
const std::shared_ptr< SyncedMemory > & | data () const |
|
const Dtype * | cpu_data () const |
|
void | set_cpu_data (Dtype *data) |
|
const int * | gpu_shape () const |
|
const Dtype * | gpu_data () const |
|
void | set_gpu_data (Dtype *data) |
|
Dtype * | mutable_cpu_data () |
|
Dtype * | mutable_gpu_data () |
|
void | set_head_gpu () |
|
void | set_head_cpu () |
|
SyncedMemory::SyncedHead | head () const |
|
void | ShareData (const Blob &other) |
| Set the data_ std::shared_ptr to point to the SyncedMemory holding the data_ of Blob other – useful in Layers which simply perform a copy in their Forward pass.
|
|
template<typename Dtype>
class apollo::perception::base::Blob< Dtype >
A wrapper around SyncedMemory holders serving as the basic computational unit for images, feature maps, etc.
TODO(dox): more thorough description.
在文件 blob.h 第 88 行定义.
template<typename Dtype >
Change the dimensions of the blob, allocating new memory if necessary.
This function can be called both to create an initial allocation of memory, and to adjust the dimensions of a top blob during Layer::Reshape or Layer::Forward. When changing the size of blob, memory will only be reallocated if sufficient memory does not already exist, and excess memory will never be freed.
Note that reshaping an input blob and immediately calling Net::Backward is an error; either Net::Forward or Net::Reshape need to be called to propagate the new input shape to higher layers.
在文件 blob.cc 第 83 行定义.
83 {
90 }
91 int* shape_data =
static_cast<int*
>(
shape_data_->mutable_cpu_data());
92 for (
size_t i = 0; i <
shape.size(); ++i) {
93 CHECK_GE(
shape[i], 0);
95 CHECK_LE(
shape[i], std::numeric_limits<int>::max() /
count_)
96 << "blob size exceeds std::numeric_limits<int>::max()";
97 }
100 shape_data[i] =
shape[i];
101 }
106 }
107}
constexpr size_t kMaxBlobAxes