MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / bert_model

Function bert_model

demo/BERT/builder.py:309–322  ·  view source on GitHub ↗

Create the bert model

(config, init_dict, network, input_tensor, input_mask)

Source from the content-addressed store, hash-verified

307 return out_layer
308
309def bert_model(config, init_dict, network, input_tensor, input_mask):
310 """
311 Create the bert model
312 """
313 prev_input = input_tensor
314 for layer in range(0, config.num_hidden_layers):
315 ss = "l{}_".format(layer)
316 out_layer = transformer_layer_opt(ss, config, init_dict, network, prev_input, input_mask)
317 prev_input = out_layer.get_output(0)
318
319 if config.use_qat:
320 dr_out = init_dict["bert_encoder_final_input_quantizer_amax"]
321 set_output_range(out_layer, dr_out)
322 return prev_input
323
324def squad_output(prefix, config, init_dict, network, input_tensor):
325 """

Callers 1

build_engineFunction · 0.70

Calls 2

transformer_layer_optFunction · 0.70
set_output_rangeFunction · 0.70

Tested by

no test coverage detected