Numpy 的 tostring(~)
方法將源數組的字節表示形式返回為字符串。請注意,此方法並不像人們預期的那樣簡單地對數組進行字符串化,即 [1,2]
不會變成 "[1,2]"
。
參數
1. order
| string
允許的值如下:
值 |
說明 |
---|---|
C |
遵循 C 的多維數組排序 |
F |
多維數組遵循 F 的排序 |
默認情況下,order="C"
。
返回值
源數組的字節表示形式為字符串。
例子
a = np.array([5,6])
a.tostring()
b'\x05\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00'
相關用法
- Python torch.distributed.rpc.rpc_async用法及代碼示例
- Python torch.nn.InstanceNorm3d用法及代碼示例
- Python torchaudio.transforms.Fade用法及代碼示例
- Python torch.special.gammaincc用法及代碼示例
- Python torch.optim.lr_scheduler.ConstantLR用法及代碼示例
- Python torch.normal用法及代碼示例
- Python torchdata.datapipes.iter.Multiplexer用法及代碼示例
- Python torch.nn.quantized.dynamic.LSTM用法及代碼示例
- Python torch.nn.EmbeddingBag用法及代碼示例
- Python torch.nn.Module.register_forward_hook用法及代碼示例
- Python torch.nn.AvgPool2d用法及代碼示例
- Python torch.nn.PixelShuffle用法及代碼示例
- Python torch.Generator.initial_seed用法及代碼示例
- Python torch.resolve_neg用法及代碼示例
- Python torchtext.vocab.Vectors.get_vecs_by_tokens用法及代碼示例
- Python torch.nn.CELU用法及代碼示例
- Python torch.reciprocal用法及代碼示例
- Python torch.nn.Hardsigmoid用法及代碼示例
- Python torch.fft.fft用法及代碼示例
- Python torch.distributed.TCPStore用法及代碼示例
- Python torch.distributed.pipeline.sync.skip.skippable.stash用法及代碼示例
- Python torch.nn.GLU用法及代碼示例
- Python torch.nn.functional.conv1d用法及代碼示例
- Python torch.sin用法及代碼示例
- Python torch.jit.save用法及代碼示例
注:本文由純淨天空篩選整理自Isshin Inada大神的英文原創作品 NumPy | tostring method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。