PyTorch torch.get_default_dtype Function


Pytorch torch 参考手册Pytorch torch Reference Manual

torch.get_default_dtypeThis is a function in PyTorch used to get the current default floating-point data type.

Function Definition

torch.get_default_dtype()

Usage Example

Example

import torch

# Get the default dtype
dtype = torch.get_default_dtype()
print("Default dtype:", dtype)

The output result is:

默认 dtype: torch.float32

Pytorch torch 参考手册Pytorch torch Reference Manual

Other Extensions