Upload file to remote runtime temp folder Parameters ---------- data : str or bytearray The file name or binary in local to upload. target : str, optional The path in remote
(self, data, target=None)
| 95 | return dev |
| 96 | |
| 97 | def upload(self, data, target=None): |
| 98 | """Upload file to remote runtime temp folder |
| 99 | |
| 100 | Parameters |
| 101 | ---------- |
| 102 | data : str or bytearray |
| 103 | The file name or binary in local to upload. |
| 104 | |
| 105 | target : str, optional |
| 106 | The path in remote |
| 107 | """ |
| 108 | if isinstance(data, bytearray): |
| 109 | if not target: |
| 110 | raise ValueError("target must present when file is a bytearray") |
| 111 | blob = data |
| 112 | else: |
| 113 | blob = bytearray(open(data, "rb").read()) |
| 114 | if not target: |
| 115 | target = os.path.basename(data) |
| 116 | |
| 117 | if "upload" not in self._remote_funcs: |
| 118 | self._remote_funcs["upload"] = self.get_function("tvm.rpc.server.upload") |
| 119 | self._remote_funcs["upload"](target, blob) |
| 120 | |
| 121 | def download(self, path): |
| 122 | """Download file from remote temp folder. |