/
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/six.h
(1425B)
#pragma once #include <pybind11/pybind11.h> #include <torch/csrc/utils/structseq.h> #include <torch/csrc/utils/object_ptr.h> namespace six { // Usually instances of PyStructSequence is also an instance of tuple // but in some py2 environment it is not, so we have to manually check // the name of the type to determine if it is a namedtupled returned // by a pytorch operator. inline bool isStructSeq(pybind11::handle input) { return pybind11::cast<std::string>(input.get_type().attr("__module__")) == "torch.return_types"; } inline bool isStructSeq(PyObject* obj) { return isStructSeq(pybind11::handle(obj)); } inline bool isTuple(pybind11::handle input) { if (PyTuple_Check(input.ptr())) { return true; } return false; } inline bool isTuple(PyObject* obj) { return isTuple(pybind11::handle(obj)); } // maybeAsTuple: if the input is a structseq, then convert it to a tuple // // On Python 3, structseq is a subtype of tuple, so these APIs could be used directly. // But on Python 2, structseq is not a subtype of tuple, so we need to manually create a // new tuple object from structseq. inline THPObjectPtr maybeAsTuple(PyStructSequence *obj) { Py_INCREF(obj); return THPObjectPtr((PyObject *)obj); } inline THPObjectPtr maybeAsTuple(PyObject *obj) { if (isStructSeq(obj)) return maybeAsTuple((PyStructSequence *)obj); Py_INCREF(obj); return THPObjectPtr(obj); } } // namespace six
Save
cmd:
run