Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions torch_xla/csrc/ir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ Node::Node(OpKind op, OpList operands, xla::Shape shape, size_t num_outputs,
hash_(xla::util::HashCombine(op_.hash(), hash_seed)) {
for (auto& operand : operands) {
AddOperand(operand.node, operand.index);
graph_size_ += operand.node->graph_size();
hash_ = xla::util::HashCombine(hash_, operand.node->hash());
graph_size_ += operand->graph_size();
hash_ = xla::util::HashCombine(hash_, operand->hash());
}
}

Expand Down
2 changes: 1 addition & 1 deletion torch_xla/csrc/ops/avg_pool2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ xla::Shape NodeOutputShape(
return BuildAvgPool2d(operands[0], kernel_size, stride, padding,
count_include_pad);
};
return InferOutputShape({input.node->shape()}, lower_for_shape_fn);
return InferOutputShape({input->shape()}, lower_for_shape_fn);
}

} // namespace
Expand Down
2 changes: 1 addition & 1 deletion torch_xla/csrc/ops/avg_pool2d_backward.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ xla::Shape NodeOutputShape(
/*input=*/operands[1], kernel_size, stride,
padding, count_include_pad);
};
return InferOutputShape({grad_output.node->shape(), input.node->shape()},
return InferOutputShape({grad_output->shape(), input->shape()},
lower_for_shape_fn);
}

Expand Down
2 changes: 1 addition & 1 deletion torch_xla/csrc/ops/conv2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ xla::Shape NodeOutputShape(
return BuildConvolution(operands[0], operands[1], stride, padding,
xla::PrecisionConfig::DEFAULT);
};
return InferOutputShape({input.node->shape(), weight.node->shape()},
return InferOutputShape({input->shape(), weight->shape()},
lower_for_shape_fn);
}

Expand Down
2 changes: 1 addition & 1 deletion torch_xla/csrc/ops/conv2d_backward.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ xla::Shape NodeOutputShape(
{grads.grad_input, grads.grad_weight, grads.grad_bias});
};
return InferOutputShape(
{grad_output.node->shape(), input.node->shape(), weight.node->shape()},
{grad_output->shape(), input->shape(), weight->shape()},
lower_for_shape_fn);
}

Expand Down
2 changes: 1 addition & 1 deletion torch_xla/csrc/ops/cross_replica_sum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace ops {

CrossReplicaSum::CrossReplicaSum(const Value& operand,
std::vector<std::vector<xla::int64>> groups)
: Node(xla_cross_replica_sum, {operand}, operand.node->shape(),
: Node(xla_cross_replica_sum, {operand}, operand->shape(),
/*num_outputs=*/1, xla::util::MHash(groups)),
groups_(std::move(groups)) {}

Expand Down
2 changes: 1 addition & 1 deletion torch_xla/csrc/ops/max_pool2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ xla::Shape NodeOutputShape(
<< "Unexpected number of operands: " << operands.size();
return BuildMaxPool2d(operands[0], kernel_size, stride, padding);
};
return InferOutputShape({input.node->shape()}, lower_for_shape_fn);
return InferOutputShape({input->shape()}, lower_for_shape_fn);
}

} // namespace
Expand Down
2 changes: 1 addition & 1 deletion torch_xla/csrc/ops/max_pool2d_backward.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ xla::Shape NodeOutputShape(
/*input=*/operands[1], kernel_size, stride,
padding);
};
return InferOutputShape({grad_output.node->shape(), input.node->shape()},
return InferOutputShape({grad_output->shape(), input->shape()},
lower_for_shape_fn);
}

Expand Down
12 changes: 6 additions & 6 deletions torch_xla/csrc/ops/ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ NodePtr ReluOp(const Value& input) {
return BuildRelu(operands[0]);
};
xla::Shape output_shape =
ir::ops::InferOutputShape({input.node->shape()}, lower_for_shape_fn);
ir::ops::InferOutputShape({input->shape()}, lower_for_shape_fn);
return ir::ops::GenericOp(ir::OpKind(at::aten::relu), ir::OpList{input},
output_shape, std::move(lower_fn));
}
Expand All @@ -42,7 +42,7 @@ NodePtr TransposeOp(const Value& input) {
return xla::Transpose(operands[0], {1, 0});
};
xla::Shape output_shape =
ir::ops::InferOutputShape({input.node->shape()}, lower_for_shape_fn);
ir::ops::InferOutputShape({input->shape()}, lower_for_shape_fn);
return ir::ops::GenericOp(ir::OpKind(at::aten::t), ir::OpList{input},
output_shape, std::move(lower_fn));
}
Expand Down Expand Up @@ -78,7 +78,7 @@ NodePtr AddMatMulOp(const Value& input, const Value& weight, const Value& bias,
return xla::Dot(operands[0], operands[1]);
};
xla::Shape output_shape = ir::ops::InferOutputShape(
{input.node->shape(), weight.node->shape()}, lower_for_shape_fn);
{input->shape(), weight->shape()}, lower_for_shape_fn);
return ir::ops::GenericOp(ir::OpKind(at::aten::addmm),
ir::OpList{input, weight, bias}, output_shape,
std::move(lower_fn));
Expand Down Expand Up @@ -106,7 +106,7 @@ NodePtr MatMulOp(const Value& input, const Value& weight,
return xla::Dot(operands[0], operands[1]);
};
xla::Shape output_shape = ir::ops::InferOutputShape(
{input.node->shape(), weight.node->shape()}, lower_for_shape_fn);
{input->shape(), weight->shape()}, lower_for_shape_fn);
return ir::ops::GenericOp(ir::OpKind(at::aten::mm), ir::OpList{input, weight},
output_shape, std::move(lower_fn));
}
Expand All @@ -125,7 +125,7 @@ NodePtr NllLossOp(const Value& logits, const Value& labels) {
return BuildNllLoss(/*logits=*/operands[0], /*labels=*/operands[1]);
};
xla::Shape output_shape = ir::ops::InferOutputShape(
{logits.node->shape(), labels.node->shape()}, lower_for_shape_fn);
{logits->shape(), labels->shape()}, lower_for_shape_fn);
return ir::ops::GenericOp(ir::OpKind(at::aten::nll_loss),
ir::OpList{logits, labels}, output_shape,
std::move(lower_fn));
Expand All @@ -145,7 +145,7 @@ NodePtr NllLossBackwardOp(const Value& logits, const Value& labels) {
return BuildNllLossBackward(/*logits=*/operands[0], /*labels=*/operands[1]);
};
xla::Shape output_shape = ir::ops::InferOutputShape(
{logits.node->shape(), labels.node->shape()}, lower_for_shape_fn);
{logits->shape(), labels->shape()}, lower_for_shape_fn);
return ir::ops::GenericOp(ir::OpKind(at::aten::nll_loss_backward),
ir::OpList{logits, labels}, output_shape,
std::move(lower_fn));
Expand Down
2 changes: 1 addition & 1 deletion torch_xla/csrc/ops/softmax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ xla::Shape NodeOutputShape(const Value& input, xla::int64 dim) {
<< "Unexpected number of operands: " << operands.size();
return BuildLogSoftmax(operands[0], dim);
};
return InferOutputShape({input.node->shape()}, lower_for_shape_fn);
return InferOutputShape({input->shape()}, lower_for_shape_fn);
}

} // namespace
Expand Down
2 changes: 1 addition & 1 deletion torch_xla/csrc/ops/threshold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace ir {
namespace ops {

Threshold::Threshold(const Value& input, float threshold, float value)
: Node(ir::OpKind(at::aten::threshold), {input}, input.node->shape(),
: Node(ir::OpKind(at::aten::threshold), {input}, input->shape(),
/*num_outputs=*/1, xla::util::MHash(threshold, value)),
threshold_(threshold),
value_(value) {}
Expand Down
2 changes: 1 addition & 1 deletion torch_xla/csrc/ops/threshold_backward.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace ops {
ThresholdBackward::ThresholdBackward(const Value& grad_output,
const Value& input, float threshold)
: Node(ir::OpKind(at::aten::threshold_backward), {grad_output, input},
input.node->shape(), /*num_outputs=*/1, xla::util::MHash(threshold)),
input->shape(), /*num_outputs=*/1, xla::util::MHash(threshold)),
threshold_(threshold) {}

XlaOpVector ThresholdBackward::Lower(LoweringContext* loctx) const {
Expand Down
2 changes: 1 addition & 1 deletion torch_xla/csrc/ops/view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ xla::Shape NodeOutputShape(
<< "Unexpected number of operands: " << operands.size();
return BuildView(operands[0], output_sizes);
};
return InferOutputShape({input.node->shape()}, lower_for_shape_fn);
return InferOutputShape({input->shape()}, lower_for_shape_fn);
}

} // namespace
Expand Down