mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
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.
22 lines
508 B
C++
22 lines
508 B
C++
#define __STDC_FORMAT_MACROS
|
|
|
|
#include <Python.h>
|
|
#include <structmember.h>
|
|
|
|
#include <TH/THMath.h>
|
|
#include <stdbool.h>
|
|
#include <vector>
|
|
#include <stack>
|
|
#include <tuple>
|
|
#include "torch/csrc/cuda/THCP.h"
|
|
|
|
#include "torch/csrc/cuda/override_macros.h"
|
|
#include "torch/csrc/copy_utils.h"
|
|
#include "torch/csrc/DynamicTypes.h"
|
|
#include "torch/csrc/utils/tensor_numpy.h"
|
|
|
|
//generic_include THC torch/csrc/generic/Tensor.cpp
|
|
|
|
#include "torch/csrc/cuda/undef_macros.h"
|
|
#include "torch/csrc/cuda/restore_macros.h"
|