/
usr
/
local
/
lib64
/
python3.6
/
site-packages
/
torch
/
include
/
ATen
/
native
/
/usr/local/lib64/python3.6/site-packages/torch/include/ATen/native
mkdir
upload
Name
Size
Mode
Actions
cpu/
-
0755
rm
cuda/
-
0755
rm
quantized/
-
0755
rm
Activation.h
3069
0644
edit
dl
rm
AdaptivePooling.h
1165
0644
edit
dl
rm
BatchLinearAlgebra.h
8246
0644
edit
dl
rm
batch_norm.h
1285
0644
edit
dl
rm
BinaryOps.h
4916
0644
edit
dl
rm
BucketizationUtils.h
4248
0644
edit
dl
rm
ComplexHelper.h
3797
0644
edit
dl
rm
CompositeRandomAccessor.h
888
0644
edit
dl
rm
CompositeRandomAccessorCommon.h
6713
0644
edit
dl
rm
ConvUtils.h
5350
0644
edit
dl
rm
Copy.h
356
0644
edit
dl
rm
CPUBlas.h
4199
0644
edit
dl
rm
CPUFallback.h
2404
0644
edit
dl
rm
Cross.h
262
0644
edit
dl
rm
DilatedConvolutionUtils.h
6416
0644
edit
dl
rm
DispatchStub.h
7672
0644
edit
dl
rm
Distance.h
732
0644
edit
dl
rm
Distributions.h
21654
0644
edit
dl
rm
DistributionTemplates.h
18623
0644
edit
dl
rm
EmbeddingBag.h
1320
0644
edit
dl
rm
Fill.h
384
0644
edit
dl
rm
ForeachUtils.h
5962
0644
edit
dl
rm
FunctionOfAMatrixUtils.h
436
0644
edit
dl
rm
GridSampler.h
10525
0644
edit
dl
rm
group_norm.h
896
0644
edit
dl
rm
Histogram.h
492
0644
edit
dl
rm
im2col.h
2838
0644
edit
dl
rm
im2col_shape_check.h
6181
0644
edit
dl
rm
IndexingUtils.h
5373
0644
edit
dl
rm
layer_norm.h
2892
0644
edit
dl
rm
Lerp.h
553
0644
edit
dl
rm
LinearAlgebra.h
603
0644
edit
dl
rm
LinearAlgebraUtils.h
25236
0644
edit
dl
rm
LossMulti.h
2197
0644
edit
dl
rm
Math.h
91356
0644
edit
dl
rm
MathBitFallThroughLists.h
4086
0644
edit
dl
rm
MathBitsFallback.h
7326
0644
edit
dl
rm
MaxPooling.h
1234
0644
edit
dl
rm
Normalization.h
302
0644
edit
dl
rm
PointwiseOps.h
749
0644
edit
dl
rm
Pool.h
10922
0644
edit
dl
rm
Pow.h
1694
0644
edit
dl
rm
ReduceAllOps.h
378
0644
edit
dl
rm
ReduceOps.h
1745
0644
edit
dl
rm
ReduceOpsUtils.h
12245
0644
edit
dl
rm
Repeat.h
1286
0644
edit
dl
rm
Resize.h
6501
0644
edit
dl
rm
ResizeCommon.h
1321
0644
edit
dl
rm
RNN.h
2467
0644
edit
dl
rm
ScatterGatherChecks.h
3641
0644
edit
dl
rm
SegmentReduce.h
685
0644
edit
dl
rm
SharedReduceOps.h
15785
0644
edit
dl
rm
SobolEngineOpsUtils.h
1723
0644
edit
dl
rm
Sorting.h
536
0644
edit
dl
rm
SortingUtils.h
5722
0644
edit
dl
rm
SpectralOpsUtils.h
3146
0644
edit
dl
rm
StridedRandomAccessor.h
6847
0644
edit
dl
rm
TensorAdvancedIndexing.h
3072
0644
edit
dl
rm
TensorCompare.h
1333
0644
edit
dl
rm
TensorDimApply.h
1832
0644
edit
dl
rm
TensorFactories.h
3382
0644
edit
dl
rm
TensorIterator.h
46
0644
edit
dl
rm
TensorIteratorDynamicCasting.h
2025
0644
edit
dl
rm
TensorShape.h
1049
0644
edit
dl
rm
TensorTransformations.h
938
0644
edit
dl
rm
TriangularOpsUtils.h
2000
0644
edit
dl
rm
TypeProperties.h
496
0644
edit
dl
rm
UnaryOps.h
4464
0644
edit
dl
rm
Unfold2d.h
551
0644
edit
dl
rm
Unfold3d.h
852
0644
edit
dl
rm
UnfoldBackward.h
5398
0644
edit
dl
rm
UpSample.h
13599
0644
edit
dl
rm
vol2col.h
3642
0644
edit
dl
rm
Edit:
/usr/local/lib64/python3.6/site-packages/torch/include/ATen/native/ComplexHelper.h
(3797B)
#pragma once #include <ATen/ATen.h> #include <c10/util/irange.h> // WARNING: this header contains non-inline functions and should be only // included from ONE cpp file namespace at { namespace native { // View tensor with new dtype, storage offset, sizes and strides inline Tensor view_tensor( const Tensor &tensor, ScalarType dtype, int64_t offset, IntArrayRef sizes, IntArrayRef strides) { Storage storage = tensor.storage(); auto key_set = tensor.key_set().remove(DispatchKey::Conjugate); auto new_tensor = detail::make_tensor<TensorImpl>( c10::TensorImpl::VIEW, std::move(storage), key_set, scalarTypeToTypeMeta(dtype)); auto * impl = new_tensor.unsafeGetTensorImpl(); impl->set_storage_offset(offset); impl->set_sizes_and_strides(sizes, strides); return new_tensor; } inline DimVector computeStrideForViewAsReal(IntArrayRef oldstride) { DimVector res(oldstride.size() + 1); for(size_t i = 0; i < oldstride.size(); i++) { res[i] = oldstride[i] * 2; } res.back() = 1; return res; } Tensor _view_as_real_physical(const Tensor& self) { TORCH_CHECK(self.is_complex(), "view_as_real is only supported for complex tensors"); auto old_sizes = self.sizes(); DimVector new_sizes(old_sizes.size() + 1); std::copy(old_sizes.begin(), old_sizes.end(), new_sizes.begin()); // last dimension will always have two elements containing the real and imag vals new_sizes.back() = 2; auto new_strides = computeStrideForViewAsReal(self.strides()); auto new_storage_offset = 2 * self.storage_offset(); const auto float_type = c10::toValueType(self.scalar_type()); auto real_tensor = view_tensor(self, float_type, new_storage_offset, new_sizes, new_strides); return real_tensor; } // expects as input a complex tensor and returns back a tensor // with corresponding real dtype containing the complex values // in the last two dimensions Tensor view_as_real(const Tensor& self) { TORCH_CHECK(!self.is_conj(), "view_as_real doesn't work on unresolved conjugated tensors. To resolve the conjugate tensor so you can view it as real, use self.resolve_conj(); however, be warned that the resulting tensor will NOT alias the original."); return _view_as_real_physical(self); } inline DimVector computeStrideForViewAsComplex(IntArrayRef oldstride) { const int64_t dim = oldstride.size(); TORCH_CHECK(oldstride[dim-1] == 1, "Tensor must have a last dimension with stride 1"); DimVector res(dim - 1); for (const auto i : c10::irange(res.size())) { TORCH_CHECK(oldstride[i] % 2 == 0, "Tensor must have a stride divisible by 2 for all but last dimension"); res[i] = oldstride[i] / 2; } return res; } // expects as input a float or double tensor with last dimension of size 2 // and returns back a tensor with corresponding complex dtype Tensor view_as_complex(const Tensor& self) { TORCH_CHECK( self.scalar_type() == kFloat || self.scalar_type() == kDouble || self.scalar_type() == kHalf, "view_as_complex is only supported for half, float and double tensors, but got a tensor of scalar type: ", self.scalar_type()); auto old_sizes = self.sizes(); TORCH_CHECK(old_sizes.size() != 0, "Input tensor must have one or more dimensions"); TORCH_CHECK(old_sizes[old_sizes.size()-1] == 2, "Tensor must have a last dimension of size 2"); DimVector new_sizes(old_sizes.begin(), old_sizes.end() - 1); const auto new_strides = computeStrideForViewAsComplex(self.strides()); const auto complex_type = c10::toComplexType(self.scalar_type()); TORCH_CHECK(self.storage_offset() % 2 == 0, "Tensor must have a storage_offset divisible by 2"); const auto new_storage_offset = self.storage_offset() / 2; return view_tensor(self, complex_type, new_storage_offset, new_sizes, new_strides); } }} // namespace at::native
Save
cmd:
run