mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
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
30 lines
726 B
C++
30 lines
726 B
C++
#include <torch/csrc/lazy/ts_backend/ops/expand.h>
|
|
|
|
namespace torch {
|
|
namespace lazy {
|
|
|
|
Expand::Expand(
|
|
const Value& input,
|
|
std::vector<int64_t> size,
|
|
bool is_scalar_expand)
|
|
: TsNode(
|
|
ClassOpKind(),
|
|
{input},
|
|
/*num_outputs=*/1,
|
|
MHash(size, is_scalar_expand)),
|
|
size_(std::move(size)),
|
|
is_scalar_expand_(is_scalar_expand) {
|
|
addComputedShape(
|
|
[&]() { return Shape(input.shape().scalar_type(), size_); });
|
|
}
|
|
|
|
std::string Expand::ToString() const {
|
|
std::stringstream ss;
|
|
ss << TsNode::ToString() << ", size=(" << c10::Join(", ", size_)
|
|
<< "), is_scalar_expand=" << is_scalar_expand_;
|
|
return ss.str();
|
|
}
|
|
|
|
} // namespace lazy
|
|
} // namespace torch
|