Learn more  » Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

neilisaac / torch   python

Repository URL to install this package:

Version: 1.8.0 

/ include / ATen / core / rref_interface.h

#pragma once

#include <c10/util/intrusive_ptr.h>

namespace c10 {

struct Type;
using TypePtr = std::shared_ptr<Type>;
using worker_id_t = int16_t;

// This abstract class contains only user-facing APIs, and will be shared
// between jit and distributed to implement TorchScript support.
class C10_EXPORT RRefInterface : public c10::intrusive_ptr_target {
 public:
  RRefInterface() = default;
  // RRef is made NOT copyable NOT movable to prevent messing up reference
  // counting.
  RRefInterface(const RRefInterface& other) = delete;
  RRefInterface(RRefInterface&& other) = delete;
  RRefInterface& operator=(RRefInterface&& other) = delete;

  virtual ~RRefInterface() = default;

  // returns the worker id of the owner
  virtual worker_id_t owner() const = 0;

  // returns the worker name of the owner
  virtual std::string ownerName() const = 0;

  // Returns true if this is the ``OwnerRRef``
  virtual bool isOwner() const = 0;

  // Returns true if this is an ``OwnerRRef`` or if this ``UserRRef`` has been
  // confirmed by its owner.
  virtual bool confirmedByOwner() const = 0;

  virtual const TypePtr type() const = 0;
};

}