edspdf.utils.torch
compute_pdf_relative_positions(x0, y0, x1, y1, width, height, n_relative_positions)
Compute relative positions between boxes. Input boxes must be split between pages with the shape n_pages * n_boxes
| PARAMETER | DESCRIPTION |
|---|---|
x0 |
|
y0 |
|
x1 |
|
y1 |
|
width |
|
height |
|
n_relative_positions |
Maximum range of embeddable relative positions between boxes (further distances will be capped to ±n_relative_positions // 2)
|
| RETURNS | DESCRIPTION |
|---|---|
torch.LongTensor
|
Shape: n_pages * n_boxes * n_boxes * 2 |
Source code in edspdf/utils/torch.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
log_einsum_exp(formula, *ops)
Numerically stable log of einsum of exponents of operands
Source code in edspdf/utils/torch.py
76 77 78 79 80 81 82 83 84 | |