jactorch.utils.meta#

Functions

as_cpu(obj)

Move elements in a Python data structure to CPU.

as_cuda(obj)

Move elements in a Python data structure to CPU.

as_detached(obj[, clone])

Detach elements in a Python data structure.

as_float(obj)

Convert elements in a Python data structure to Python floating-point scalars.

as_numpy(obj)

Convert elements in a Python data structure to numpy arrays.

as_tensor(obj)

Convert elements in a Python data structure to tensors.

as_variable(obj)

DEPRECATED(Jiayuan Mao): as_variable has been deprecated and will be removed by 10/23/2018; please use as_tensor instead.

mark_volatile(obj)

DEPRECATED(Jiayuan Mao): mark_volatile has been deprecated and will be removed by 10/23/2018; please use torch.no_grad instead.

Functions

as_cpu(obj)[source]#

Move elements in a Python data structure to CPU. Only changes tensors and variables (PyTorch 0.x).

as_cuda(obj)[source]#

Move elements in a Python data structure to CPU. Only changes tensors and variables (PyTorch 0.x).

as_detached(obj, clone=False)[source]#

Detach elements in a Python data structure. Only changes tensors and variables (PyTorch 0.x).

Parameters:

clone (bool) – if True, clone the tensor before detaching.

as_float(obj)[source]#

Convert elements in a Python data structure to Python floating-point scalars. Supported types: tensor, variable (PyTorch 0.x), numpy array, and Python scalars.

as_numpy(obj)[source]#

Convert elements in a Python data structure to numpy arrays. Supported types: tensor, variable (PyTorch 0.x), numpy array, and Python scalars.

as_tensor(obj)[source]#

Convert elements in a Python data structure to tensors. Supported types: tensor, variable (PyTorch 0.x), numpy array, and Python scalars.

as_variable(obj)[source]#

DEPRECATED(Jiayuan Mao): as_variable has been deprecated and will be removed by 10/23/2018; please use as_tensor instead.

mark_volatile(obj)[source]#

DEPRECATED(Jiayuan Mao): mark_volatile has been deprecated and will be removed by 10/23/2018; please use torch.no_grad instead.