(var)
| 88 | |
| 89 | |
| 90 | def to_numpy(var): |
| 91 | assert isinstance( |
| 92 | var, (Variable, base.core.eager.Tensor, paddle.base.libpaddle.pir.Value) |
| 93 | ), "not a variable" |
| 94 | if isinstance(var, base.core.eager.Tensor): |
| 95 | return np.array(var) |
| 96 | t = global_scope().find_var(var.name).get_tensor() |
| 97 | return np.array(t) |
| 98 | |
| 99 | |
| 100 | def flatten_list(l): |
no test coverage detected