Home / Class/ LinearOpContext Class — pytorch Architecture

LinearOpContext Class — pytorch Architecture

Architecture documentation for the LinearOpContext class in OpContext.h from the pytorch codebase.

Entity Profile

Source Code

aten/src/ATen/native/xnnpack/OpContext.h lines 38–54

class LinearOpContext : public torch::jit::CustomClassHolder {
 protected:
  Tensor orig_weight_;
  std::optional<Tensor> orig_bias_;
  std::optional<Scalar> output_min_;
  std::optional<Scalar> output_max_;
  bool orig_weight_and_bias_freed_;

 public:
  SerializationTypeLinearPrePack unpack() {
    TORCH_CHECK(!orig_weight_and_bias_freed_, "Original weight and bias have been freed");
    return std::make_tuple(orig_weight_, orig_bias_, output_min_, output_max_);
  }

  virtual Tensor run(const Tensor& input) = 0;
  virtual void free_orig_weight_and_bias() = 0;
};

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free