Files
pytorch/torch/csrc/lazy/ts_backend/ops/cast.h
Bin Bao 8f5cdc6d5d Revert "Revert "[LT] Store OpKind for each IR subclass in a static field""
Summary: Re-land https://github.com/pytorch/pytorch/pull/76711 by
fixing internal build errors.
Generate class-level opkind as a static method instead of a static
member.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/77102

Approved by: https://github.com/wconstab, https://github.com/JackCaoG, https://github.com/antoniojkim
2022-05-11 12:27:05 +00:00

39 lines
744 B
C++

#pragma once
#include <c10/core/ScalarType.h>
#include <c10/util/Optional.h>
#include <torch/csrc/lazy/core/internal_ops/ltc_ops.h>
#include <torch/csrc/lazy/ts_backend/ts_node.h>
namespace torch {
namespace lazy {
class TORCH_API Cast : public TsNode {
public:
static OpKind ClassOpKind() {
return ltc_cast;
}
Cast(
const Value& input,
at::ScalarType dtype,
c10::optional<at::ScalarType> stype = c10::nullopt);
std::string ToString() const override;
at::ScalarType dtype() const {
return dtype_;
}
const c10::optional<at::ScalarType>& stype() const {
return stype_;
}
private:
at::ScalarType dtype_;
c10::optional<at::ScalarType> stype_;
};
} // namespace lazy
} // namespace torch