MCPcopy Create free account
hub / github.com/AllentDan/LibtorchTutorials / features

Method features

lesson6-Segmentation/ResNet.cpp:107–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107std::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
128torch::nn::Sequential ResNetImpl::_make_layer(int64_t planes, int64_t blocks, int64_t stride) {
129

Callers 1

forwardMethod · 0.80

Calls 2

push_backMethod · 0.80
forwardMethod · 0.45

Tested by

no test coverage detected