1 #include "caffe2/operators/locally_connected_op_util.h" 8 void SetColumnBufferShape(
10 const int kernel_size,
11 const int output_image_size,
12 const std::vector<int>& output_image_dims,
13 const StorageOrder order,
14 std::vector<int>* column_slice_dims,
15 std::vector<int>* column_dims,
16 std::vector<int>* column_transposed_dims,
17 std::vector<int>* column_axes) {
18 column_slice_dims->resize(output_image_dims.size() + 1);
19 if (order == StorageOrder::NCHW) {
20 column_slice_dims->front() = kernel_size;
22 output_image_dims.cbegin(),
23 output_image_dims.cend(),
24 column_slice_dims->begin() + 1);
27 output_image_dims.cbegin(),
28 output_image_dims.cend(),
29 column_slice_dims->begin());
30 column_slice_dims->back() = kernel_size;
32 *column_dims = order == StorageOrder::NCHW
33 ? std::vector<int>{N, kernel_size, output_image_size}
34 : std::vector<int>{N, output_image_size, kernel_size};
35 *column_transposed_dims = order == StorageOrder::NCHW
36 ? std::vector<int>{output_image_size, kernel_size, N}
37 : std::vector<int>{output_image_size, N, kernel_size};
38 *column_axes = order == StorageOrder::NCHW ? std::vector<int>{2, 1, 0}
39 : std::vector<int>{1, 0, 2};
45 const int output_image_size,
46 const StorageOrder order,
47 std::vector<int>* Y_dims,
48 std::vector<int>* Y_transposed_dims,
49 std::vector<int>* Y_axes) {
50 *Y_dims = order == StorageOrder::NCHW
51 ? std::vector<int>{N, M, output_image_size}
52 : std::vector<int>{N, output_image_size, M};
53 *Y_transposed_dims = order == StorageOrder::NCHW
54 ? std::vector<int>{output_image_size, M, N}
55 : std::vector<int>{output_image_size, N, M};
56 *Y_axes = order == StorageOrder::NCHW ? std::vector<int>{2, 1, 0}
57 : std::vector<int>{1, 0, 2};
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...