/
usr
/
local
/
lib64
/
python3.6
/
site-packages
/
torch
/
include
/
torch
/
csrc
/
utils
/
/usr/local/lib64/python3.6/site-packages/torch/include/torch/csrc/utils
mkdir
upload
Name
Size
Mode
Actions
auto_gil.h
1034
0644
edit
dl
rm
byte_order.h
2484
0644
edit
dl
rm
crash_handler.h
1146
0644
edit
dl
rm
cuda_enabled.h
154
0644
edit
dl
rm
cuda_lazy_init.h
974
0644
edit
dl
rm
disable_torch_function.h
863
0644
edit
dl
rm
disallow_copy.h
103
0644
edit
dl
rm
init.h
324
0644
edit
dl
rm
invalid_arguments.h
302
0644
edit
dl
rm
memory.h
1173
0644
edit
dl
rm
numpy_stub.h
399
0644
edit
dl
rm
object_ptr.h
1329
0644
edit
dl
rm
out_types.h
294
0644
edit
dl
rm
pybind.h
7966
0644
edit
dl
rm
pycfunction_helpers.h
209
0644
edit
dl
rm
python_arg_parser.h
30753
0644
edit
dl
rm
python_compat.h
2904
0644
edit
dl
rm
python_dispatch.h
174
0644
edit
dl
rm
python_numbers.h
5064
0644
edit
dl
rm
python_scalars.h
2928
0644
edit
dl
rm
python_strings.h
4592
0644
edit
dl
rm
python_stub.h
56
0644
edit
dl
rm
python_tuples.h
684
0644
edit
dl
rm
six.h
1425
0644
edit
dl
rm
structseq.h
153
0644
edit
dl
rm
tensor_apply.h
431
0644
edit
dl
rm
tensor_dtypes.h
244
0644
edit
dl
rm
tensor_flatten.h
2780
0644
edit
dl
rm
tensor_layouts.h
107
0644
edit
dl
rm
tensor_list.h
196
0644
edit
dl
rm
tensor_memoryformats.h
113
0644
edit
dl
rm
tensor_new.h
1807
0644
edit
dl
rm
tensor_numpy.h
542
0644
edit
dl
rm
tensor_qschemes.h
186
0644
edit
dl
rm
tensor_types.h
491
0644
edit
dl
rm
throughput_benchmark-inl.h
5210
0644
edit
dl
rm
throughput_benchmark.h
6868
0644
edit
dl
rm
variadic.h
4394
0644
edit
dl
rm
Edit:
/usr/local/lib64/python3.6/site-packages/torch/include/torch/csrc/utils/python_compat.h
(2904B)
#pragma once #include <torch/csrc/python_headers.h> #if PY_VERSION_HEX < 0x03070000 // METH_FASTCALL was introduced in Python 3.7, so we wrap _PyCFunctionFast // signatures for earlier versions. template <PyObject* (*f)(PyObject*, PyObject *const *, Py_ssize_t)> PyObject* maybe_wrap_fastcall(PyObject *module, PyObject *args) { return f( module, // _PyTuple_ITEMS // Because this is only a compat shim for Python 3.6, we don't have // to worry about the representation changing. ((PyTupleObject *)args)->ob_item, PySequence_Fast_GET_SIZE(args) ); } #define MAYBE_METH_FASTCALL METH_VARARGS #define MAYBE_WRAP_FASTCALL(f) maybe_wrap_fastcall<f> #else #define MAYBE_METH_FASTCALL METH_FASTCALL #define MAYBE_WRAP_FASTCALL(f) (PyCFunction)(void(*)(void))f #endif // PyPy 3.6 does not yet have PySlice_Unpack #if PY_VERSION_HEX < 0x03060100 || defined(PYPY_VERSION) // PySlice_Unpack not introduced till python 3.6.1 // included here for backwards compatibility // https://docs.python.org/3/c-api/slice.html#c.PySlice_Unpack // https://github.com/python/cpython/blob/master/Objects/sliceobject.c#L196 inline int __PySlice_Unpack(PyObject *_r, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step) { PySliceObject *r = (PySliceObject*)_r; /* this is harder to get right than you might think */ // Py_BUILD_ASSERT replaced because it is not available in all versions static_assert(PY_SSIZE_T_MIN + 1 <= -PY_SSIZE_T_MAX, "Build failed"); if (r->step == Py_None) { *step = 1; } else { if (!_PyEval_SliceIndex(r->step, step)) return -1; if (*step == 0) { PyErr_SetString(PyExc_ValueError, "slice step cannot be zero"); return -1; } /* Here *step might be -PY_SSIZE_T_MAX-1; in this case we replace it * with -PY_SSIZE_T_MAX. This doesn't affect the semantics, and it * guards against later undefined behaviour resulting from code that * does "step = -step" as part of a slice reversal. */ if (*step < -PY_SSIZE_T_MAX) *step = -PY_SSIZE_T_MAX; } if (r->start == Py_None) { *start = *step < 0 ? PY_SSIZE_T_MAX : 0; } else { if (!_PyEval_SliceIndex(r->start, start)) return -1; } if (r->stop == Py_None) { *stop = *step < 0 ? PY_SSIZE_T_MIN : PY_SSIZE_T_MAX; } else { if (!_PyEval_SliceIndex(r->stop, stop)) return -1; } return 0; } #define THPUtils_unpackSlice(SLICE, START, STOP, STEP) \ (__PySlice_Unpack(SLICE, START, STOP, STEP) == 0) #else #define THPUtils_unpackSlice(SLICE, START, STOP, STEP) \ (PySlice_Unpack(SLICE, START, STOP, STEP) == 0) #endif #define THPUtils_parseSlice(SLICE, LEN, START, STOP, LENGTH, STEP) \ (PySlice_GetIndicesEx(SLICE, LEN, START, STOP, LENGTH, STEP) == 0)
Save
cmd:
run