Files
pytorch/torch/csrc/Tensor.cpp
Sam Gross d0cabbde74 Implement Variable.from_numpy (#4043)
Implements from_numpy using ATen tensors. Variable.from_numpy is a
convenient placeholder for the variant that returns Variables until we
merge Tensor and Variable.

The behavior is slightly changed:

 - from_numpy() on an empty array now returns an empty tensor instead of
   throwing an exception. The shape may not be preserved.
 - CharTensor(ndarray) used to throw an exception. It now copies the
   ndarray. Copying is implemented via ATen toType.
2017-12-06 14:08:56 -05:00

20 lines
392 B
C++

#define __STDC_FORMAT_MACROS
#include <Python.h>
#include <structmember.h>
#define THP_HOST_HALF
#include <stdbool.h>
#include <vector>
#include <stack>
#include <tuple>
#include <TH/THMath.h>
#include "torch/csrc/THP.h"
#include "torch/csrc/copy_utils.h"
#include "torch/csrc/DynamicTypes.h"
#include "torch/csrc/utils/tensor_numpy.h"
//generic_include TH torch/csrc/generic/Tensor.cpp