xref: /aosp_15_r20/external/pytorch/torch/csrc/jit/ir/attributes.cpp (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 #include <c10/util/irange.h>
2 #include <torch/csrc/jit/ir/attributes.h>
3 #include <torch/csrc/jit/ir/ir.h>
4 
5 namespace torch::jit {
6 
clone() const7 AttributeValue::Ptr GraphAttr::clone() const {
8   return Ptr(new GraphAttr(name, value_->copy()));
9 }
10 
clone() const11 std::unique_ptr<AttributeValue> GraphsAttr::clone() const {
12   std::vector<std::shared_ptr<Graph>> copy(value_.size());
13   for (const auto i : c10::irange(value_.size())) {
14     copy[i] = value_.at(i)->copy();
15   }
16   return Ptr(new GraphsAttr(name, std::move(copy)));
17 }
18 
19 } // namespace torch::jit
20