Shortcuts

Program Listing for File normalization.h

Return to documentation for file (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 {

struct TORCH_API LayerNormOptions {
  /* implicit */ LayerNormOptions(std::vector<int64_t> normalized_shape);
  TORCH_ARG(std::vector<int64_t>, normalized_shape);
  TORCH_ARG(double, eps) = 1e-5;
  TORCH_ARG(bool, elementwise_affine) = true;
};

// ============================================================================

namespace functional {

struct TORCH_API LayerNormFuncOptions {
  /* implicit */ LayerNormFuncOptions(std::vector<int64_t> normalized_shape);
  TORCH_ARG(std::vector<int64_t>, normalized_shape);

  TORCH_ARG(Tensor, weight) = {};

  TORCH_ARG(Tensor, bias) = {};

  TORCH_ARG(double, eps) = 1e-5;
};

} // namespace functional

// ============================================================================

struct TORCH_API LocalResponseNormOptions {
  /* implicit */ LocalResponseNormOptions(int64_t size) : size_(size) {}
  TORCH_ARG(int64_t, size);

  TORCH_ARG(double, alpha) = 1e-4;

  TORCH_ARG(double, beta) = 0.75;

  TORCH_ARG(double, k) = 1.;
};

namespace functional {
using LocalResponseNormFuncOptions = LocalResponseNormOptions;
} // namespace functional

// ============================================================================

struct TORCH_API CrossMapLRN2dOptions {
  CrossMapLRN2dOptions(int64_t size);

  TORCH_ARG(int64_t, size);

  TORCH_ARG(double, alpha) = 1e-4;

  TORCH_ARG(double, beta) = 0.75;

  TORCH_ARG(int64_t, k) = 1;
};

// ============================================================================

namespace functional {

struct TORCH_API NormalizeFuncOptions {
  TORCH_ARG(double, p) = 2.0;
  TORCH_ARG(int64_t, dim) = 1;
  TORCH_ARG(double, eps) = 1e-12;
  TORCH_ARG(c10::optional<Tensor>, out) = c10::nullopt;
};

} // namespace functional

// ============================================================================

struct TORCH_API GroupNormOptions {
  /* implicit */ GroupNormOptions(int64_t num_groups, int64_t num_channels);

  TORCH_ARG(int64_t, num_groups);
  TORCH_ARG(int64_t, num_channels);
  TORCH_ARG(double, eps) = 1e-5;
  TORCH_ARG(bool, affine) = true;
};

// ============================================================================

namespace functional {

struct TORCH_API GroupNormFuncOptions {
  /* implicit */ GroupNormFuncOptions(int64_t num_groups);

  TORCH_ARG(int64_t, num_groups);

  TORCH_ARG(Tensor, weight) = {};

  TORCH_ARG(Tensor, bias) = {};

  TORCH_ARG(double, eps) = 1e-5;
};

} // namespace functional

} // namespace nn
} // namespace torch

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources