| 943 | return tensor(value, dtype=dtype, device=device)._dev_tensor() |
| 944 | |
| 945 | def calculate(*args, **kwargs): |
| 946 | output_val = [] |
| 947 | # set inputs value |
| 948 | for name, var in inputs.items(): |
| 949 | val = kwargs.pop(name, None) |
| 950 | assert val is not None, "miss input name{}".format(name) |
| 951 | dev_tensor = make_dev_tensor(val, dtype=var.dtype, device="xpux") |
| 952 | inp_map[name].set_value(dev_tensor) |
| 953 | |
| 954 | func.execute() |
| 955 | |
| 956 | for res in output_nodes: |
| 957 | output_val.append(res.get_value().numpy()) |
| 958 | return output_val |
| 959 | |
| 960 | def expect_name(var): |
| 961 | return "{}:expect".format(var.name) |