MCPcopy
hub / github.com/PaddlePaddle/PaddleOCR / test_unimernet_head

Function test_unimernet_head

tests/ppocr/test_formula_model.py:85–106  ·  view source on GitHub ↗

Test UniMERNet head. Args: encoder_feat: encoder feature from unimernet backbone.

(encoder_feat)

Source from the content-addressed store, hash-verified

83
84
85def test_unimernet_head(encoder_feat):
86 """
87 Test UniMERNet head.
88
89 Args:
90 encoder_feat: encoder feature from unimernet backbone.
91 """
92 head = UniMERNetHead(
93 max_new_tokens=5,
94 decoder_start_token_id=0,
95 temperature=0.2,
96 do_sample=False,
97 top_p=0.95,
98 encoder_hidden_size=1024,
99 is_export=False,
100 length_aware=True,
101 )
102
103 head.eval()
104 with paddle.no_grad():
105 result = head(encoder_feat)
106 assert result.shape == [1, 6]
107
108
109def test_ppformulanet_s_backbone(sample_image_ppformulanet_s):

Callers

nothing calls this directly

Calls 2

UniMERNetHeadClass · 0.90
evalMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…