| 105 | } |
| 106 | |
| 107 | std::vector<torch::Tensor> ResNetImpl::features(torch::Tensor x){ |
| 108 | std::vector<torch::Tensor> features; |
| 109 | features.push_back(x); |
| 110 | x = conv1->forward(x); |
| 111 | x = bn1->forward(x); |
| 112 | x = torch::relu(x); |
| 113 | features.push_back(x); |
| 114 | x = torch::max_pool2d(x, 3, 2, 1); |
| 115 | |
| 116 | x = layer1->forward(x); |
| 117 | features.push_back(x); |
| 118 | x = layer2->forward(x); |
| 119 | features.push_back(x); |
| 120 | x = layer3->forward(x); |
| 121 | features.push_back(x); |
| 122 | x = layer4->forward(x); |
| 123 | features.push_back(x); |
| 124 | |
| 125 | return features; |
| 126 | } |
| 127 | |
| 128 | torch::nn::Sequential ResNetImpl::_make_layer(int64_t planes, int64_t blocks, int64_t stride) { |
| 129 | |