mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
* Add torch.empty, torch.full and new_ size Tensor factory methods. This adds torch.full, torch.empty equivalents of np.full, np.empty. In addition, this adds size-based Tensor factory methods new_empty, new_ones, new_full, new_zeros, which is meant to complete the separation of the legacy "new" method into data-based and size-based functions. This also fixes an issue in sparse zeros_like when the dtype didn't match the argument dtype. * Get rid of unnecessary zero in sparse tensor zeros_like. * Fix test if only 1 cuda device.
18 lines
763 B
C++
18 lines
763 B
C++
#pragma once
|
|
|
|
#include <Python.h>
|
|
#include <ATen/ATen.h>
|
|
|
|
namespace torch { namespace utils {
|
|
|
|
at::Tensor legacy_tensor_ctor(const at::Type& type, PyObject* args, PyObject* kwargs);
|
|
at::Tensor legacy_tensor_new(const at::Type& type, PyObject* args, PyObject* kwargs);
|
|
at::Tensor new_tensor(const at::Type& type, PyObject* args, PyObject* kwargs);
|
|
at::Tensor new_from_data(const at::Type& type, int device, PyObject *data);
|
|
at::Tensor new_empty(const at::Type& type, PyObject* args, PyObject* kwargs);
|
|
at::Tensor new_full(const at::Type& type, PyObject* args, PyObject* kwargs);
|
|
at::Tensor new_ones(const at::Type& type, PyObject* args, PyObject* kwargs);
|
|
at::Tensor new_zeros(const at::Type& type, PyObject* args, PyObject* kwargs);
|
|
|
|
}} // namespace torch::utils
|