13 #include <autogradpp/autograd.h> 22 using nonlin_type = std::function<torch::Tensor(torch::Tensor)>;
28 std::function<ag::Container(uint32_t, uint32_t, int, int, int, bool)>;
43 TORCH_ARG(
int, map_embsize) = 64;
44 TORCH_ARG(
int, race_embsize) = 8;
45 TORCH_ARG(
int, kernel_size) = 128;
46 TORCH_ARG(
int, stride) = 32;
48 void reset()
override;
50 ag::Variant forward(ag::Variant input)
override;
56 ag::Container embedR_;
73 convsize_0_(convsize_0),
77 input_size_(input_size),
78 interm_size_(interm_size),
79 output_size_(output_size){};
81 TORCH_ARG(
int, depth) = 2;
82 TORCH_ARG(
int, stride_0) = 1;
83 TORCH_ARG(
int, stride) = 1;
85 void reset()
override;
87 ag::Variant forward(ag::Variant input)
override;
91 std::vector<ag::Container> convS_;
92 ag::Container conv_output_;
128 convsize_0_(convsize_0),
130 input_size_(input_size),
131 interm_size_(interm_size),
132 output_size_(output_size){};
134 TORCH_ARG(
int, depth) = 2;
135 TORCH_ARG(
int, stride_0) = 1;
136 TORCH_ARG(
int, stride) = 1;
138 void reset()
override;
140 ag::Variant forward(ag::Variant input)
override;
143 ag::Container convnet_;
165 kernel_size_(kernel_size),
166 n_inp_feats_(n_inp_feats),
170 TORCH_ARG(
int, map_embsize) = 64;
171 TORCH_ARG(
int, race_embsize) = 8;
172 TORCH_ARG(
int, dec_convsize) = 3;
173 TORCH_ARG(
int, dec_depth) = 3;
174 TORCH_ARG(
int, dec_embsize) = 128;
175 TORCH_ARG(
int, hid_dim) = 256;
176 TORCH_ARG(
float, lstm_dropout) = 0;
179 TORCH_ARG(
bool, bypass_encoder) =
false;
180 TORCH_ARG(
int, enc_convsize) = 3;
181 TORCH_ARG(
int, enc_embsize) = 256;
182 TORCH_ARG(
int, enc_depth) = 3;
183 TORCH_ARG(
int, inp_embsize) = 256;
184 TORCH_ARG(std::string, top_pooling) =
"mean";
186 TORCH_ARG(
bool, predict_delta) =
false;
189 TORCH_ARG(
int, midconv_kw) = 3;
190 TORCH_ARG(
int, midconv_stride) = 2;
191 TORCH_ARG(
int, midconv_depth) = 2;
192 TORCH_ARG(
int, n_lvls) = 2;
193 TORCH_ARG(utils::UpsampleMode, upsample) = utils::UpsampleMode::Bilinear;
194 TORCH_ARG(std::string, model_name) =
"multilvl_lstm";
196 void reset()
override;
201 ag::Variant forward(ag::Variant input)
override;
204 void load_parameters(std::string
const& path_to_npz);
207 void repackage_hidden();
209 torch::Tensor encode(torch::Tensor x);
210 torch::Tensor do_rnn_middle(torch::Tensor x, at::IntList sz,
int i);
211 torch::Tensor pooling(torch::Tensor x, std::string method =
"");
212 ag::tensor_list trunk_encode_pool(ag::tensor_list input);
213 torch::Tensor do_rnn(
214 torch::Tensor x, at::IntList size, torch::Tensor & hidden);
215 ag::tensor_list do_heads(torch::Tensor x);
216 ag::tensor_list forward_rest(ag::tensor_list input);
221 ag::Container trunk_;
222 ag::Container sum_pool_embed_;
223 ag::Container conv1x1_;
224 std::vector<ag::Container> midnets_;
225 std::vector<ag::Container> midrnns_;
227 ag::Container decoder_;
228 ag::Container regression_head_;
229 ag::Container unit_class_head_;
230 ag::Container bldg_class_head_;
231 ag::Container opbt_class_head_;
233 ag::tensor_list append_to_decoder_input_;
234 std::vector<torch::Tensor> hidden_;
236 at::IntList input_sz_;
246 #ifndef WITHOUT_POSIX 247 static std::unique_ptr<cnpy::npz_t> layers;
250 static std::string prefix;
ag::Container conv2dBuilder(uint32_t input_size, uint32_t output_size, int convsize, int stride, int padding, bool no_bias)
Definition: defogger.cpp:15
AUTOGRAD_CONTAINER_CLASS(MapRaceFeaturize)
Definition: defogger.h:39
std::function< torch::Tensor(torch::Tensor)> nonlin_type
Definition: defogger.h:22
Convnet SimpleConvnet(conv_builder conv, nonlin_type nonlin, int convsize, int padding, int input_size, int output_size, int depth, int stride)
Definition: defogger.cpp:169
std::function< ag::Container(uint32_t, uint32_t, int, int, int, bool)> conv_builder
Definition: defogger.h:28
Main namespace for bot-related code.
Definition: areainfo.cpp:17