(arg)
| 241 | |
| 242 | |
| 243 | def argument_to_cpp_code(arg): |
| 244 | if isinstance(arg, str): |
| 245 | return arg |
| 246 | elif isinstance(arg, bool): |
| 247 | return "true" if arg else "false" |
| 248 | elif isinstance(arg, (int, float)) and not isinstance(arg, bool): |
| 249 | # Note: We explicitly exclude bool because bool is a subset of int |
| 250 | return str(arg) |
| 251 | elif isinstance(arg, bool): |
| 252 | return "true" if arg else "false" |
| 253 | elif isinstance(arg, torch.Tensor): |
| 254 | return tensor_to_cpp_code(arg) |
| 255 | elif isinstance(arg, ArgType): |
| 256 | return arg.to_cpp() |
| 257 | return "?" |
| 258 | |
| 259 | |
| 260 | def argument_to_pytorch(arg): |
no test coverage detected