repo stringlengths 1 152 ⌀ | file stringlengths 14 221 | code stringlengths 501 25k | file_length int64 501 25k | avg_line_length float64 20 99.5 | max_line_length int64 21 134 | extension_type stringclasses 2
values |
|---|---|---|---|---|---|---|
null | pytorch-main/torch/csrc/api/include/torch/data/datasets/stateful.h | #pragma once
#include <torch/data/datasets/base.h>
#include <torch/data/example.h>
#include <cstddef>
#include <vector>
namespace torch {
namespace serialize {
class OutputArchive;
class InputArchive;
} // namespace serialize
} // namespace torch
namespace torch {
namespace data {
namespace datasets {
/// A statef... | 2,304 | 31.464789 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/data/datasets/tensor.h | #pragma once
#include <torch/data/datasets/base.h>
#include <torch/data/example.h>
#include <torch/types.h>
#include <cstddef>
#include <vector>
namespace torch {
namespace data {
namespace datasets {
/// A dataset of tensors.
/// Stores a single tensor internally, which is then indexed inside `get()`.
struct Tenso... | 954 | 23.487179 | 77 | h |
null | pytorch-main/torch/csrc/api/include/torch/data/detail/data_shuttle.h | #pragma once
#include <torch/data/detail/queue.h>
#include <torch/types.h>
#include <c10/util/Exception.h>
#include <c10/util/Optional.h>
#include <chrono>
#include <utility>
namespace torch {
namespace data {
namespace detail {
/// Encapsulates the full life cycle of DataLoader jobs.
///
/// When a new job is enq... | 2,626 | 28.852273 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/data/detail/queue.h | #pragma once
#include <torch/types.h>
#include <c10/util/Exception.h>
#include <chrono>
#include <condition_variable>
#include <cstddef>
#include <mutex>
#include <queue>
namespace torch {
namespace data {
namespace detail {
/// A basic locked, blocking MPMC queue.
///
/// Every `push` and `pop` is guarded by a mu... | 2,486 | 28.258824 | 79 | h |
null | pytorch-main/torch/csrc/api/include/torch/data/detail/sequencers.h | #pragma once
#include <torch/types.h>
#include <algorithm>
#include <cstddef>
#include <vector>
namespace torch {
namespace data {
namespace detail {
namespace sequencers {
namespace detail {
template <typename Result>
bool buffer_contains_result(const std::vector<optional<Result>>& buffer) {
return std::any_of(
... | 4,470 | 38.219298 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/data/samplers/base.h | #pragma once
#include <torch/csrc/Export.h>
#include <torch/types.h>
#include <cstddef>
#include <mutex>
#include <vector>
namespace torch {
namespace serialize {
class OutputArchive;
class InputArchive;
} // namespace serialize
} // namespace torch
namespace torch {
namespace data {
namespace samplers {
/// A `Sam... | 1,230 | 24.645833 | 72 | h |
null | pytorch-main/torch/csrc/api/include/torch/data/samplers/distributed.h | #pragma once
#include <torch/csrc/Export.h>
#include <torch/data/samplers/base.h>
#include <cstddef>
#include <vector>
namespace torch {
namespace serialize {
class OutputArchive;
class InputArchive;
} // namespace serialize
} // namespace torch
namespace torch {
namespace data {
namespace samplers {
/// A `Sample... | 4,120 | 28.435714 | 78 | h |
null | pytorch-main/torch/csrc/api/include/torch/data/samplers/random.h | #pragma once
#include <torch/csrc/Export.h>
#include <torch/data/samplers/base.h>
#include <torch/types.h>
#include <cstddef>
#include <vector>
namespace torch {
namespace serialize {
class OutputArchive;
class InputArchive;
} // namespace serialize
} // namespace torch
namespace torch {
namespace data {
namespace ... | 1,522 | 26.690909 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/data/samplers/sequential.h | #pragma once
#include <torch/csrc/Export.h>
#include <torch/data/samplers/base.h>
#include <torch/types.h>
#include <cstddef>
#include <vector>
namespace torch {
namespace serialize {
class OutputArchive;
class InputArchive;
} // namespace serialize
} // namespace torch
namespace torch {
namespace data {
namespace ... | 1,254 | 23.607843 | 73 | h |
null | pytorch-main/torch/csrc/api/include/torch/data/samplers/serialize.h | #pragma once
#include <torch/data/samplers/base.h>
#include <torch/serialize/archive.h>
namespace torch {
namespace data {
namespace samplers {
/// Serializes a `Sampler` into an `OutputArchive`.
template <typename BatchRequest>
serialize::OutputArchive& operator<<(
serialize::OutputArchive& archive,
const Sa... | 707 | 23.413793 | 52 | h |
null | pytorch-main/torch/csrc/api/include/torch/data/samplers/stream.h | #pragma once
#include <torch/csrc/Export.h>
#include <torch/data/samplers/base.h>
#include <torch/data/samplers/custom_batch_request.h>
#include <torch/types.h>
#include <cstddef>
namespace torch {
namespace serialize {
class InputArchive;
class OutputArchive;
} // namespace serialize
} // namespace torch
namespace... | 2,033 | 30.78125 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/data/transforms/base.h | #pragma once
#include <torch/types.h>
#include <utility>
#include <vector>
namespace torch {
namespace data {
namespace transforms {
/// A transformation of a batch to a new batch.
template <typename InputBatch, typename OutputBatch>
class BatchTransform {
public:
using InputBatchType = InputBatch;
using Outpu... | 1,629 | 29.185185 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/data/transforms/collate.h | #pragma once
#include <torch/data/example.h>
#include <torch/data/transforms/lambda.h>
#include <vector>
namespace torch {
namespace data {
namespace transforms {
/// A `Collation` is a transform that reduces a batch into a single value.
/// The result is a `BatchDataset` that has the type of the single value as it... | 1,113 | 29.944444 | 79 | h |
null | pytorch-main/torch/csrc/api/include/torch/data/transforms/lambda.h | #pragma once
#include <torch/data/transforms/base.h>
#include <functional>
#include <utility>
#include <vector>
namespace torch {
namespace data {
namespace transforms {
/// A `BatchTransform` that applies a user-provided functor to a batch.
template <typename Input, typename Output = Input>
class BatchLambda : pub... | 1,709 | 29 | 77 | h |
null | pytorch-main/torch/csrc/api/include/torch/data/transforms/stack.h | #pragma once
#include <torch/data/example.h>
#include <torch/data/transforms/collate.h>
#include <torch/types.h>
#include <utility>
#include <vector>
namespace torch {
namespace data {
namespace transforms {
template <typename T = Example<>>
struct Stack;
/// A `Collation` for `Example<Tensor, Tensor>` types that ... | 1,424 | 27.5 | 76 | h |
null | pytorch-main/torch/csrc/api/include/torch/data/transforms/tensor.h | #pragma once
#include <torch/data/example.h>
#include <torch/data/transforms/base.h>
#include <torch/types.h>
#include <functional>
#include <utility>
namespace torch {
namespace data {
namespace transforms {
/// A `Transform` that is specialized for the typical `Example<Tensor, Tensor>`
/// combination. It exposes... | 2,473 | 30.717949 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/detail/static.h | #pragma once
#include <torch/csrc/utils/variadic.h>
#include <torch/types.h>
#include <cstdint>
#include <type_traits>
namespace torch {
namespace nn {
class Module;
} // namespace nn
} // namespace torch
namespace torch {
namespace detail {
/// Detects if a type T has a forward() method.
template <typename T>
stru... | 2,200 | 32.348485 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/cloneable.h | #pragma once
#include <torch/nn/module.h>
#include <torch/types.h>
#include <torch/utils.h>
#include <c10/core/TensorOptions.h>
#include <c10/util/Exception.h>
#include <memory>
#include <utility>
namespace torch {
namespace nn {
/// The `clone()` method in the base `Module` class does not have knowledge of
/// the... | 3,900 | 38.40404 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/functional.h | #pragma once
#include <torch/nn/functional/batchnorm.h>
#include <torch/nn/functional/conv.h>
#include <torch/nn/functional/distance.h>
#include <torch/nn/functional/dropout.h>
#include <torch/nn/functional/embedding.h>
#include <torch/nn/functional/fold.h>
#include <torch/nn/functional/instancenorm.h>
#include <torch... | 642 | 34.722222 | 46 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/init.h | #pragma once
#include <torch/csrc/Export.h>
#include <torch/enum.h>
#include <torch/types.h>
namespace torch {
namespace nn {
namespace init {
using NonlinearityType = c10::variant<
enumtype::kLinear,
enumtype::kConv1D,
enumtype::kConv2D,
enumtype::kConv3D,
enumtype::kConvTranspose1D,
enumtyp... | 4,967 | 38.744 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules.h | #pragma once
// Common
#include <torch/nn/modules/common.h>
// Containers
#include <torch/nn/modules/container/any.h>
#include <torch/nn/modules/container/functional.h>
#include <torch/nn/modules/container/moduledict.h>
#include <torch/nn/modules/container/modulelist.h>
#include <torch/nn/modules/container/named_any.... | 1,289 | 33.864865 | 53 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/options.h | #pragma once
#include <torch/nn/options/batchnorm.h>
#include <torch/nn/options/conv.h>
#include <torch/nn/options/dropout.h>
#include <torch/nn/options/fold.h>
#include <torch/nn/options/linear.h>
#include <torch/nn/options/loss.h>
#include <torch/nn/options/normalization.h>
#include <torch/nn/options/padding.h>
#inc... | 645 | 33 | 46 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/pimpl-inl.h | // This class exists only to do SFINAE on abstract types `T` that are really
// `ModuleHolder<ModuleType>`, because there's no good way to say that `T` is a
// `ModuleHolder` over some unknown type `ModuleType`. With this, you can do
// `enable_if_t<is_base_of_v<ModuleHolderIndicator, T>>`.
struct ModuleHolderIndicato... | 3,196 | 41.626667 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/pimpl.h | #pragma once
#include <torch/arg.h>
#include <torch/detail/static.h>
#include <torch/serialize/archive.h>
#include <torch/types.h>
#include <torch/csrc/utils/variadic.h>
#include <memory>
#include <type_traits>
#include <utility>
namespace torch {
namespace detail {
// Dump all the template metaprogramming in this ... | 7,102 | 32.037209 | 79 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/functional/batchnorm.h | #pragma once
#include <c10/util/irange.h>
#include <torch/nn/options/batchnorm.h>
#include <torch/types.h>
namespace torch {
namespace nn {
namespace functional {
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace detail {
inline Tensor batch_norm(
const Tensor& input,
const Tensor& running_mean,
const Tensor& r... | 1,975 | 23.7 | 98 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/functional/conv.h | #pragma once
#include <torch/nn/options/conv.h>
#include <torch/types.h>
namespace torch {
namespace nn {
namespace functional {
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace detail {
inline std::string padding_unwrap(enumtype::kValid) {
return "valid";
}
inline std::string padding_unwrap(enumtype::kSame) {
retur... | 8,159 | 26.019868 | 91 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/functional/distance.h | #pragma once
#include <torch/nn/options/distance.h>
namespace torch {
namespace nn {
namespace functional {
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace detail {
inline Tensor cosine_similarity(
const Tensor& x1,
const Tensor& x2,
int64_t dim,
double eps) {
return torch::cosine_similarity(x1, x2, dim... | 2,553 | 27.696629 | 92 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/functional/dropout.h | #pragma once
#include <torch/nn/options/dropout.h>
#include <utility>
namespace torch {
namespace nn {
namespace functional {
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace detail {
inline Tensor dropout(Tensor input, double p, bool training, bool inplace) {
TORCH_CHECK(
p >= 0. && p <= 1.,
"dropout prob... | 6,596 | 27.07234 | 96 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/functional/fold.h | #pragma once
#include <torch/nn/options/fold.h>
namespace torch {
namespace nn {
namespace functional {
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace detail {
inline Tensor fold(
const Tensor& input,
ExpandingArray<2> output_size,
ExpandingArray<2> kernel_size,
ExpandingArray<2> dilation,
ExpandingA... | 2,790 | 26.097087 | 87 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/functional/instancenorm.h | #pragma once
#include <torch/nn/options/instancenorm.h>
namespace torch {
namespace nn {
namespace functional {
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace detail {
inline Tensor instance_norm(
const Tensor& input,
const Tensor& running_mean,
const Tensor& running_var,
const Tensor& weight,
const ... | 1,607 | 24.125 | 125 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/functional/linear.h | #pragma once
#include <torch/types.h>
namespace torch {
namespace nn {
namespace functional {
inline Tensor bilinear(
const Tensor& input1,
const Tensor& input2,
const Tensor& weight,
const Tensor& bias = Tensor()) {
return torch::bilinear(input1, input2, weight, bias);
}
// ======================... | 811 | 20.368421 | 79 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/functional/normalization.h | #pragma once
#include <torch/nn/functional/padding.h>
#include <torch/nn/functional/pooling.h>
#include <torch/nn/options/normalization.h>
#include <torch/types.h>
namespace torch {
namespace nn {
namespace functional {
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace detail {
inline Tensor normalize(
const Tensor& in... | 6,029 | 27.443396 | 94 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/functional/padding.h | #pragma once
#include <ATen/PadNd.h>
#include <torch/nn/options/padding.h>
namespace torch {
namespace nn {
namespace functional {
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace detail {
inline Tensor pad(
const Tensor& input,
IntArrayRef pad,
PadFuncOptions::mode_t mode,
double value) {
const auto mod... | 1,686 | 27.59322 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/functional/pixelshuffle.h | #pragma once
#include <torch/nn/options/pixelshuffle.h>
namespace torch {
namespace nn {
namespace functional {
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace detail {
inline Tensor pixel_shuffle(const Tensor& input, int64_t upscale_factor) {
return torch::pixel_shuffle(input, upscale_factor);
}
inline Tensor pixel_u... | 1,345 | 27.041667 | 88 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/functional/upsampling.h | #pragma once
#include <c10/util/irange.h>
#include <torch/nn/functional/pooling.h>
#include <torch/nn/options/upsampling.h>
#include <cmath>
#include <utility>
namespace torch {
namespace nn {
namespace functional {
inline std::vector<int64_t> _interp_output_size(
int64_t dim,
std::tuple<
Tensor,
... | 10,471 | 36.266904 | 95 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/functional/vision.h | #pragma once
#include <torch/nn/options/vision.h>
#include <torch/types.h>
namespace torch {
namespace nn {
namespace functional {
inline Tensor affine_grid(
const Tensor& theta,
const IntArrayRef& size,
bool align_corners = false) {
// enforce floating point dtype on theta
TORCH_CHECK(
theta.i... | 3,637 | 28.104 | 103 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/_functions.h | #pragma once
#include <torch/csrc/autograd/custom_function.h>
#include <torch/csrc/autograd/variable.h>
#include <torch/nn/options/normalization.h>
#include <torch/types.h>
namespace torch {
namespace nn {
namespace functions {
class CrossMapLRN2d : public torch::autograd::Function<CrossMapLRN2d> {
public:
static... | 706 | 25.185185 | 71 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/adaptive.h | #pragma once
#include <torch/nn/cloneable.h>
#include <torch/nn/functional/activation.h>
#include <torch/nn/module.h>
#include <torch/nn/modules/container/modulelist.h>
#include <torch/nn/modules/container/sequential.h>
#include <torch/nn/modules/linear.h>
#include <torch/nn/options/adaptive.h>
namespace torch {
name... | 3,510 | 30.918182 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/batchnorm.h | #pragma once
#include <torch/nn/cloneable.h>
#include <torch/nn/functional/batchnorm.h>
#include <torch/nn/init.h>
#include <torch/nn/options/batchnorm.h>
#include <torch/nn/pimpl.h>
#include <torch/types.h>
#include <cstdint>
namespace torch {
namespace nn {
/// Base class for all (dimension-specialized) batchnorm... | 7,917 | 32.693617 | 96 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/common.h | #pragma once
/// This macro enables a module with default arguments in its forward method
/// to be used in a Sequential module.
///
/// Example usage:
///
/// Let's say we have a module declared like this:
/// ```
/// struct MImpl : torch::nn::Module {
/// public:
/// explicit MImpl(int value_) : value(value_) {}
... | 4,318 | 43.071429 | 79 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/conv.h | #pragma once
#include <c10/util/irange.h>
#include <c10/util/overloaded.h>
#include <torch/expanding_array.h>
#include <torch/nn/cloneable.h>
#include <torch/nn/init.h>
#include <torch/nn/modules/common.h>
#include <torch/nn/modules/utils.h>
#include <torch/nn/options/conv.h>
#include <torch/nn/pimpl.h>
#include <tor... | 16,247 | 35.106667 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/distance.h | #pragma once
#include <torch/nn/cloneable.h>
#include <torch/nn/functional/distance.h>
#include <torch/nn/options/distance.h>
#include <torch/nn/pimpl.h>
#include <torch/types.h>
#include <torch/csrc/Export.h>
namespace torch {
namespace nn {
/// Returns the cosine similarity between :math:`x_1` and :math:`x_2`, co... | 3,085 | 34.471264 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/dropout.h | #pragma once
#include <torch/nn/cloneable.h>
#include <torch/nn/options/dropout.h>
#include <torch/nn/pimpl.h>
#include <torch/types.h>
#include <torch/csrc/Export.h>
#include <cstddef>
#include <vector>
namespace torch {
namespace nn {
namespace detail {
template <typename Derived>
class _DropoutNd : public torc... | 6,525 | 33.167539 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/embedding.h | #pragma once
#include <torch/nn/cloneable.h>
#include <torch/nn/functional/embedding.h>
#include <torch/nn/modules/common.h>
#include <torch/nn/options/embedding.h>
#include <torch/nn/pimpl.h>
#include <torch/types.h>
#include <cstddef>
namespace torch {
namespace nn {
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Embedding... | 6,224 | 35.19186 | 106 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/fold.h | #pragma once
#include <torch/expanding_array.h>
#include <torch/nn/cloneable.h>
#include <torch/nn/functional/fold.h>
#include <torch/nn/options/fold.h>
#include <torch/nn/pimpl.h>
#include <torch/types.h>
namespace torch {
namespace nn {
/// Applies fold over a 3-D input.
/// See https://pytorch.org/docs/master/nn.... | 2,851 | 31.409091 | 79 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/instancenorm.h | #pragma once
#include <torch/nn/modules/batchnorm.h>
#include <torch/nn/options/instancenorm.h>
namespace torch {
namespace nn {
/// Base class for all (dimension-specialized) instance norm modules
template <size_t D, typename Derived>
class InstanceNormImpl
: public torch::nn::NormImplBase<D, Derived, InstanceN... | 5,046 | 33.568493 | 99 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/linear.h | #pragma once
#include <torch/nn/cloneable.h>
#include <torch/nn/functional/linear.h>
#include <torch/nn/module.h>
#include <torch/nn/options/linear.h>
#include <torch/nn/pimpl.h>
#include <torch/types.h>
#include <cstddef>
#include <vector>
namespace torch {
namespace nn {
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Ident... | 7,455 | 33.67907 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/normalization.h | #pragma once
#include <torch/nn/cloneable.h>
#include <torch/nn/functional/normalization.h>
#include <torch/nn/modules/_functions.h>
#include <torch/nn/options/normalization.h>
#include <torch/nn/pimpl.h>
#include <torch/types.h>
#include <cstddef>
#include <vector>
namespace torch {
namespace nn {
// ~~~~~~~~~~~~~... | 6,932 | 33.839196 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/padding.h | #pragma once
#include <torch/expanding_array.h>
#include <torch/nn/cloneable.h>
#include <torch/nn/functional/padding.h>
#include <torch/csrc/Export.h>
namespace torch {
namespace nn {
/// Base class for all (dimension-specialized) ReflectionPad modules.
template <size_t D, typename Derived>
class TORCH_API Reflect... | 14,389 | 36.968338 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/pixelshuffle.h | #pragma once
#include <torch/nn/cloneable.h>
#include <torch/nn/functional/pixelshuffle.h>
#include <torch/nn/options/pixelshuffle.h>
#include <torch/csrc/Export.h>
namespace torch {
namespace nn {
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PixelShuffle
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/// Rearranges elements in a ... | 3,138 | 34.269663 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/rnn.h | #pragma once
#include <torch/nn/cloneable.h>
#include <torch/nn/modules/common.h>
#include <torch/nn/modules/dropout.h>
#include <torch/nn/options/rnn.h>
#include <torch/nn/pimpl.h>
#include <torch/nn/utils/rnn.h>
#include <torch/types.h>
#include <ATen/ATen.h>
#include <c10/util/Exception.h>
#include <cstddef>
#inc... | 13,577 | 32.44335 | 79 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/transformer.h | #pragma once
#include <torch/nn/cloneable.h>
#include <torch/nn/module.h>
#include <torch/nn/modules/common.h>
#include <torch/nn/options/transformer.h>
#include <torch/nn/pimpl.h>
#include <torch/types.h>
#include <ostream>
namespace torch {
namespace nn {
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Transformer ~~~~~~~~~~~~... | 5,347 | 36.138889 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/transformercoder.h | #pragma once
#include <torch/nn/cloneable.h>
#include <torch/nn/module.h>
#include <torch/nn/modules/common.h>
#include <torch/nn/modules/container/any.h>
#include <torch/nn/modules/container/modulelist.h>
#include <torch/nn/options/transformercoder.h>
#include <torch/nn/pimpl.h>
#include <torch/types.h>
#include <o... | 5,210 | 32.619355 | 79 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/transformerlayer.h | #pragma once
#include <torch/nn/cloneable.h>
#include <torch/nn/module.h>
#include <torch/nn/modules/activation.h>
#include <torch/nn/modules/common.h>
#include <torch/nn/modules/dropout.h>
#include <torch/nn/modules/linear.h>
#include <torch/nn/modules/normalization.h>
#include <torch/nn/options/transformerlayer.h>
#... | 6,436 | 31.841837 | 83 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/upsampling.h | #pragma once
#include <torch/nn/cloneable.h>
#include <torch/nn/functional/upsampling.h>
#include <torch/nn/options/upsampling.h>
#include <torch/nn/pimpl.h>
#include <torch/types.h>
#include <torch/csrc/Export.h>
#include <cstddef>
#include <ostream>
namespace torch {
namespace nn {
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~... | 1,653 | 28.535714 | 89 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/utils.h | #pragma once
#include <c10/util/ArrayRef.h>
#include <c10/util/Optional.h>
#include <c10/util/irange.h>
#include <vector>
namespace torch {
namespace nn {
namespace modules {
namespace utils {
// Reverse the order of `t` and repeat each element for `n` times.
// This can be used to translate padding arg used by Con... | 1,517 | 26.107143 | 77 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/container/any.h | #pragma once
#include <torch/detail/static.h>
#include <torch/nn/module.h>
#include <torch/nn/modules/container/any_module_holder.h>
#include <torch/nn/modules/container/any_value.h>
#include <torch/nn/pimpl.h>
#include <torch/types.h>
#include <torch/csrc/autograd/variable.h>
#include <torch/csrc/utils/memory.h>
#in... | 13,756 | 35.783422 | 128 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/container/any_module_holder.h | #pragma once
#include <torch/nn/modules/container/any_value.h>
namespace torch {
namespace nn {
class Module;
// ~~~~~~~~~~~~~~~~~~~~~~~~~~ AnyModulePlaceholder ~~~~~~~~~~~~~~~~~~~~~~~~~~
/// The static type of the object we store in the `AnyModule`, which erases
/// the actual type, but allows us to call `forward... | 4,800 | 34.828358 | 117 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/container/any_value.h | #pragma once
#include <torch/detail/static.h>
#include <torch/nn/module.h>
#include <torch/nn/pimpl.h>
#include <torch/types.h>
#include <torch/csrc/autograd/variable.h>
#include <torch/csrc/utils/memory.h>
#include <torch/csrc/utils/variadic.h>
#include <memory>
#include <type_traits>
#include <typeinfo>
#include <... | 4,040 | 31.58871 | 81 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/container/functional.h | #pragma once
#include <torch/csrc/Export.h>
#include <torch/csrc/utils/variadic.h>
#include <torch/nn/cloneable.h>
#include <torch/nn/pimpl.h>
#include <torch/types.h>
#include <functional>
#include <utility>
namespace torch {
namespace nn {
/// Wraps a function in a `Module`.
///
/// The `Functional` module allows... | 3,441 | 31.471698 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/container/moduledict.h | #pragma once
#include <torch/nn/cloneable.h>
#include <torch/nn/module.h>
#include <torch/ordered_dict.h>
#include <vector>
namespace torch {
namespace nn {
/// An OrderedDict of `Module`s that registers its elements by their `key`s.
///
/// \rst
/// .. code-block:: cpp
///
/// torch::OrderedDict<std::string, std:... | 8,437 | 31.08365 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/container/modulelist.h | #pragma once
#include <c10/util/irange.h>
#include <torch/nn/cloneable.h>
#include <torch/nn/module.h>
#include <utility>
#include <vector>
namespace torch {
namespace nn {
/// A list of `Module`s that registers its elements.
///
/// \rst
/// .. code-block:: cpp
///
/// torch::nn::ModuleList mlist(
/// torch:... | 8,983 | 31.669091 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/container/named_any.h | #pragma once
#include <torch/detail/static.h>
#include <torch/nn/module.h>
#include <torch/nn/modules/container/any.h>
#include <torch/nn/pimpl.h>
#include <torch/types.h>
#include <torch/csrc/autograd/variable.h>
#include <torch/csrc/utils/memory.h>
#include <torch/csrc/utils/variadic.h>
#include <ATen/Device.h>
#... | 2,785 | 28.020833 | 76 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/container/parameterdict.h | #pragma once
#include <torch/nn/cloneable.h>
#include <torch/nn/pimpl.h>
#include <torch/ordered_dict.h>
#include <utility>
#include <vector>
namespace torch {
namespace nn {
class ParameterDictImpl : public Cloneable<ParameterDictImpl> {
public:
using Iterator = OrderedDict<std::string, Tensor>::Iterator;
usin... | 4,500 | 29.208054 | 79 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/container/parameterlist.h | #pragma once
#include <torch/nn/cloneable.h>
#include <torch/nn/module.h>
#include <vector>
namespace torch {
namespace nn {
class ParameterListImpl : public Cloneable<ParameterListImpl> {
public:
using Iterator = typename std::vector<
OrderedDict<std::string, torch::Tensor>::Item>::iterator;
using ConstI... | 5,612 | 32.017647 | 79 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/modules/container/sequential.h | #pragma once
#include <torch/detail/static.h>
#include <torch/nn/cloneable.h>
#include <torch/nn/module.h>
#include <torch/nn/modules/container/any.h>
#include <torch/nn/modules/container/named_any.h>
#include <torch/nn/pimpl.h>
#include <torch/types.h>
#include <c10/util/Exception.h>
#include <cstdint>
#include <me... | 13,858 | 34.264631 | 86 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/options/activation.h | #pragma once
#include <torch/arg.h>
#include <torch/csrc/Export.h>
#include <torch/enum.h>
#include <torch/types.h>
namespace torch {
namespace nn {
/// Options for the `ELU` module.
///
/// Example:
/// ```
/// ELU model(ELUOptions().alpha(42.42).inplace(true));
/// ```
struct TORCH_API ELUOptions {
/// The `alph... | 19,044 | 25.636364 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/options/adaptive.h | #pragma once
#include <torch/arg.h>
#include <torch/csrc/Export.h>
#include <torch/types.h>
namespace torch {
namespace nn {
/// Options for the `AdaptiveLogSoftmaxWithLoss` module.
///
/// Example:
/// ```
/// AdaptiveLogSoftmaxWithLoss model(AdaptiveLogSoftmaxWithLossOptions(8, 10,
/// {4, 8}).div_value(2.).head_b... | 1,082 | 24.785714 | 78 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/options/batchnorm.h | #pragma once
#include <torch/arg.h>
#include <torch/csrc/Export.h>
#include <torch/types.h>
namespace torch {
namespace nn {
/// Options for the `BatchNorm` module.
struct TORCH_API BatchNormOptions {
/* implicit */ BatchNormOptions(int64_t num_features);
/// The number of features of the input tensor.
/// Ch... | 2,799 | 28.166667 | 98 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/options/conv.h | #pragma once
#include <torch/arg.h>
#include <torch/csrc/Export.h>
#include <torch/enum.h>
#include <torch/expanding_array.h>
#include <torch/types.h>
namespace torch {
namespace nn {
namespace detail {
typedef c10::variant<
enumtype::kZeros,
enumtype::kReflect,
enumtype::kReplicate,
enumtype::kCirc... | 13,471 | 31.384615 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/options/distance.h | #pragma once
#include <torch/arg.h>
#include <torch/csrc/Export.h>
#include <torch/types.h>
namespace torch {
namespace nn {
/// Options for the `CosineSimilarity` module.
///
/// Example:
/// ```
/// CosineSimilarity model(CosineSimilarityOptions().dim(0).eps(0.5));
/// ```
struct TORCH_API CosineSimilarityOptions ... | 2,014 | 26.986111 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/options/dropout.h | #pragma once
#include <torch/arg.h>
#include <torch/csrc/Export.h>
#include <torch/types.h>
namespace torch {
namespace nn {
/// Options for the `Dropout` module.
///
/// Example:
/// ```
/// Dropout model(DropoutOptions().p(0.42).inplace(true));
/// ```
struct TORCH_API DropoutOptions {
/* implicit */ DropoutOpti... | 3,070 | 22.442748 | 77 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/options/embedding.h | #pragma once
#include <torch/arg.h>
#include <torch/csrc/Export.h>
#include <torch/enum.h>
#include <torch/types.h>
namespace torch {
namespace nn {
/// Options for the `Embedding` module.
///
/// Example:
/// ```
/// Embedding model(EmbeddingOptions(10,
/// 2).padding_idx(3).max_norm(2).norm_type(2.5).scale_grad_by... | 11,667 | 47.016461 | 91 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/options/fold.h | #pragma once
#include <torch/arg.h>
#include <torch/csrc/Export.h>
#include <torch/expanding_array.h>
#include <torch/types.h>
namespace torch {
namespace nn {
/// Options for the `Fold` module.
///
/// Example:
/// ```
/// Fold model(FoldOptions({8, 8}, {3, 3}).dilation(2).padding({2,
/// 1}).stride(2));
/// ```
st... | 2,983 | 28.84 | 79 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/options/instancenorm.h | #pragma once
#include <torch/arg.h>
#include <torch/csrc/Export.h>
#include <torch/nn/options/batchnorm.h>
#include <torch/types.h>
namespace torch {
namespace nn {
/// Options for the `InstanceNorm` module.
struct TORCH_API InstanceNormOptions {
/* implicit */ InstanceNormOptions(int64_t num_features);
/// The... | 2,321 | 24.8 | 125 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/options/linear.h | #pragma once
#include <c10/util/variant.h>
#include <torch/arg.h>
#include <torch/csrc/Export.h>
#include <torch/types.h>
namespace torch {
namespace nn {
/// Options for the `Linear` module.
///
/// Example:
/// ```
/// Linear model(LinearOptions(5, 2).bias(false));
/// ```
struct TORCH_API LinearOptions {
Linear... | 2,834 | 28.226804 | 79 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/options/normalization.h | #pragma once
#include <torch/arg.h>
#include <torch/csrc/Export.h>
#include <torch/types.h>
#include <vector>
namespace torch {
namespace nn {
/// Options for the `LayerNorm` module.
///
/// Example:
/// ```
/// LayerNorm model(LayerNormOptions({2,
/// 2}).elementwise_affine(false).eps(2e-5));
/// ```
struct TORCH_A... | 5,522 | 27.61658 | 79 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/options/padding.h | #pragma once
#include <c10/util/variant.h>
#include <torch/arg.h>
#include <torch/csrc/Export.h>
#include <torch/enum.h>
#include <torch/expanding_array.h>
#include <torch/types.h>
namespace torch {
namespace nn {
/// Options for a `D`-dimensional ReflectionPad module.
template <size_t D>
struct TORCH_API Reflection... | 6,890 | 30.180995 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/options/pixelshuffle.h | #pragma once
#include <torch/arg.h>
#include <torch/csrc/Export.h>
#include <torch/types.h>
namespace torch {
namespace nn {
/// Options for the `PixelShuffle` module.
///
/// Example:
/// ```
/// PixelShuffle model(PixelShuffleOptions(5));
/// ```
struct TORCH_API PixelShuffleOptions {
PixelShuffleOptions(int64_t... | 1,657 | 24.121212 | 79 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/options/pooling.h | #pragma once
#include <torch/arg.h>
#include <torch/csrc/Export.h>
#include <torch/expanding_array.h>
#include <torch/types.h>
namespace torch {
namespace nn {
/// Options for a `D`-dimensional avgpool module.
template <size_t D>
struct AvgPoolOptions {
AvgPoolOptions(ExpandingArray<D> kernel_size)
: kernel_... | 17,094 | 28.78223 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/options/rnn.h | #pragma once
#include <torch/arg.h>
#include <torch/csrc/Export.h>
#include <torch/enum.h>
#include <torch/types.h>
namespace torch {
namespace nn {
namespace detail {
/// Common options for RNN, LSTM and GRU modules.
struct TORCH_API RNNOptionsBase {
typedef c10::variant<
enumtype::kLSTM,
enumtype::k... | 8,264 | 33.58159 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/options/transformer.h | #pragma once
#include <torch/arg.h>
#include <torch/csrc/Export.h>
#include <torch/enum.h>
#include <torch/types.h>
#include <torch/nn/modules/container/any.h>
#include <torch/nn/options/transformerlayer.h>
namespace torch {
namespace nn {
/// Options for the `Transformer` module
///
/// Example:
/// ```
/// Transf... | 1,839 | 27.307692 | 73 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/options/transformercoder.h | #pragma once
#include <torch/arg.h>
#include <torch/csrc/Export.h>
#include <torch/enum.h>
#include <torch/types.h>
#include <torch/nn/modules/container/any.h>
#include <torch/nn/modules/transformerlayer.h>
namespace torch {
namespace nn {
/// Options for the `TransformerEncoder`
///
/// Example:
/// ```
/// Transf... | 2,344 | 29.454545 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/options/transformerlayer.h | #pragma once
#include <torch/arg.h>
#include <torch/csrc/Export.h>
#include <torch/enum.h>
#include <torch/types.h>
namespace torch {
namespace nn {
using activation_t = c10::variant<
enumtype::kReLU,
enumtype::kGELU,
std::function<Tensor(const Tensor&)>>;
/// Options for the `TransformerEncoderLayer`
/... | 2,084 | 27.561644 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/options/upsampling.h | #pragma once
#include <c10/util/variant.h>
#include <torch/arg.h>
#include <torch/csrc/Export.h>
#include <torch/enum.h>
#include <torch/expanding_array.h>
#include <torch/types.h>
#include <vector>
namespace torch {
namespace nn {
/// Options for the `Upsample` module.
///
/// Example:
/// ```
/// Upsample
/// mod... | 4,186 | 36.383929 | 110 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/options/vision.h | #pragma once
#include <torch/arg.h>
#include <torch/csrc/Export.h>
#include <torch/enum.h>
#include <torch/types.h>
namespace torch {
namespace nn {
namespace functional {
/// Options for `torch::nn::functional::grid_sample`.
///
/// Example:
/// ```
/// namespace F = torch::nn::functional;
/// F::grid_sample(input,... | 1,099 | 28.72973 | 103 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/parallel/data_parallel.h | #pragma once
#include <torch/cuda.h>
#include <torch/nn/module.h>
#include <torch/nn/pimpl.h>
#include <torch/types.h>
#include <ATen/core/functional.h>
#include <torch/csrc/autograd/functions/comm.h>
#include <torch/csrc/autograd/functions/utils.h>
#include <ATen/Device.h>
#include <ATen/Parallel.h>
#include <c10/c... | 11,126 | 36.338926 | 81 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/utils/clip_grad.h | #pragma once
#include <torch/csrc/Export.h>
#include <utility>
namespace torch {
namespace nn {
namespace utils {
// Clips gradient norm of a vector of Tensors.
// See
// https://pytorch.org/docs/stable/nn.html?highlight=clip_grad_norm#torch.nn.utils.clip_grad_norm_
// for more details about this module.
//
// Diff... | 4,874 | 31.939189 | 98 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/utils/convert_parameters.h | #pragma once
#include <torch/csrc/Export.h>
#include <torch/types.h>
namespace torch {
namespace nn {
namespace utils {
// This helper function is to check if the parameters are located
// in the same device. Currently, the conversion between model parameters
// and single vector form is not supported for multiple a... | 2,442 | 28.433735 | 78 | h |
null | pytorch-main/torch/csrc/api/include/torch/nn/utils/rnn.h | #pragma once
#include <c10/util/irange.h>
#include <torch/types.h>
#include <utility>
namespace torch {
namespace nn {
namespace utils {
namespace rnn {
inline Tensor invert_permutation(const Tensor& permutation) {
if (!permutation.defined()) {
return torch::Tensor();
}
Tensor output =
torch::empty_... | 12,741 | 34.99435 | 84 | h |
null | pytorch-main/torch/csrc/api/include/torch/optim/adagrad.h | #pragma once
#include <torch/nn/pimpl.h>
#include <torch/optim/optimizer.h>
#include <torch/optim/serialize.h>
#include <torch/serialize/archive.h>
#include <torch/types.h>
#include <utility>
#include <vector>
namespace torch {
namespace serialize {
class OutputArchive;
class InputArchive;
} // namespace serialize
}... | 3,379 | 30.296296 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/optim/adam.h | #pragma once
#include <torch/nn/module.h>
#include <torch/optim/optimizer.h>
#include <torch/optim/serialize.h>
#include <utility>
#include <vector>
namespace torch {
namespace serialize {
class OutputArchive;
class InputArchive;
} // namespace serialize
} // namespace torch
namespace torch {
namespace optim {
str... | 3,025 | 30.852632 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/optim/adamw.h | #pragma once
#include <torch/nn/module.h>
#include <torch/optim/optimizer.h>
#include <torch/optim/serialize.h>
#include <utility>
#include <vector>
namespace torch {
namespace serialize {
class OutputArchive;
class InputArchive;
} // namespace serialize
} // namespace torch
namespace torch {
namespace optim {
str... | 3,047 | 31.084211 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/optim/lbfgs.h | #pragma once
#include <torch/nn/module.h>
#include <torch/optim/optimizer.h>
#include <torch/optim/serialize.h>
#include <torch/serialize/archive.h>
#include <deque>
#include <functional>
#include <memory>
#include <vector>
namespace torch {
namespace optim {
struct TORCH_API LBFGSOptions : public OptimizerCloneabl... | 3,554 | 32.537736 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/optim/optimizer.h | #pragma once
#include <ATen/Tensor.h>
#include <c10/util/Exception.h>
#include <c10/util/flat_hash_map.h>
#include <torch/arg.h>
#include <torch/csrc/Export.h>
#include <algorithm>
#include <functional>
#include <iterator>
#include <memory>
#include <string>
#include <vector>
// Forward declarations confuse Doxygen... | 7,162 | 33.4375 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/optim/rmsprop.h | #pragma once
#include <torch/nn/module.h>
#include <torch/optim/optimizer.h>
#include <torch/optim/serialize.h>
#include <torch/serialize/archive.h>
#include <torch/types.h>
#include <functional>
#include <memory>
#include <string>
#include <vector>
namespace torch {
namespace serialize {
class OutputArchive;
class ... | 3,027 | 29.897959 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/optim/serialize.h | #pragma once
#include <c10/util/irange.h>
#include <torch/optim/optimizer.h>
#include <torch/serialize/archive.h>
#include <torch/types.h>
#include <cstddef>
#include <cstdint>
#include <deque>
#include <string>
#include <vector>
namespace torch {
namespace optim {
namespace detail {
// Utility function to save state... | 12,134 | 38.019293 | 119 | h |
null | pytorch-main/torch/csrc/api/include/torch/optim/sgd.h | #pragma once
#include <torch/nn/module.h>
#include <torch/optim/optimizer.h>
#include <torch/optim/serialize.h>
#include <torch/serialize/archive.h>
#include <torch/types.h>
#include <cstddef>
#include <utility>
#include <vector>
namespace torch {
namespace serialize {
class OutputArchive;
class InputArchive;
} // n... | 2,765 | 28.425532 | 78 | h |
null | pytorch-main/torch/csrc/api/include/torch/optim/schedulers/lr_scheduler.h | #pragma once
#include <torch/optim/optimizer.h>
#include <torch/csrc/Export.h>
namespace torch {
namespace optim {
class TORCH_API LRScheduler {
public:
// This class needs to take a reference of an optimizer from outside such that
// it can modify its learning rates; due to this the lifetime of said
// opti... | 1,073 | 25.85 | 80 | h |
null | pytorch-main/torch/csrc/api/include/torch/serialize/input-archive.h | #pragma once
#include <c10/core/Device.h>
#include <c10/util/Optional.h>
#include <torch/csrc/Export.h>
#include <torch/csrc/jit/api/module.h>
#include <torch/types.h>
#include <iosfwd>
#include <memory>
#include <string>
#include <utility>
namespace at {
class Tensor;
} // namespace at
namespace torch {
using at::... | 3,992 | 32.838983 | 80 | h |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.