Lines Matching defs:operand

166     const string& tag, HloInstruction* operand) {
169 instruction->operands_.push_back(operand);
184 HloInstruction* operand, int64 index) {
188 instruction->AppendOperand(operand);
212 for (auto operand : operands) {
213 instruction->AppendOperand(operand);
219 const Shape& shape, HloOpcode opcode, HloInstruction* operand) {
246 return CreateNary(shape, opcode, {operand});
314 for (auto operand : operands) {
315 instruction->AppendOperand(operand);
342 const Shape& shape, HloInstruction* operand, FftType fft_type,
345 instruction->AppendOperand(operand);
378 HloInstruction* operand,
383 instruction->AppendOperand(operand);
403 const Shape& shape, HloInstruction* operand,
407 CHECK(ShapeUtil::Compatible(operand->shape(), shape))
408 << "Outfeed shape " << shape << " must be compatible with operand shape "
409 << operand->shape();
410 instruction->AppendOperand(operand);
417 HloInstruction* operand, int64 channel_id) {
418 // Send instruction produces a tuple of {aliased operand, U32 context}.
420 {operand->shape(), ShapeUtil::MakeShape(U32, {})});
423 instruction->AppendOperand(operand);
429 HloInstruction* operand) {
430 CHECK(operand->opcode() == HloOpcode::kSend)
431 << "SendDone must take the context operand from Send";
434 instruction->AppendOperand(operand);
435 instruction->channel_id_ = operand->channel_id();
451 HloInstruction* operand) {
452 CHECK(operand->opcode() == HloOpcode::kRecv)
453 << "RecvDone must take the context operand from Recv";
454 Shape output_shape = ShapeUtil::GetTupleElementShape(operand->shape(), 0);
457 instruction->AppendOperand(operand);
458 instruction->channel_id_ = operand->channel_id();
463 const Shape& shape, HloInstruction* operand,
466 instruction->AppendOperand(operand);
500 const Shape& shape, HloInstruction* operand,
505 instruction->AppendOperand(operand);
519 const Shape& shape, HloInstruction* operand, HloInstruction* start_indices,
523 instruction->AppendOperand(operand);
532 HloInstruction* operand,
537 instruction->AppendOperand(operand);
548 for (auto operand : operands) {
549 instruction->AppendOperand(operand);
556 const Shape& shape, HloInstruction* operand) {
558 instruction->AppendOperand(operand);
564 HloInstruction* operand) {
567 instruction->AppendOperand(operand);
585 const Shape& shape, HloInstruction* operand, HloInstruction* init_value,
589 instruction->AppendOperand(operand);
598 HloInstruction* operand,
604 instruction->AppendOperand(operand);
614 const Shape& shape, HloInstruction* operand, HloInstruction* scale,
619 instruction->AppendOperand(operand);
630 HloInstruction::CreateBatchNormGrad(const Shape& shape, HloInstruction* operand,
637 instruction->AppendOperand(operand);
649 const Shape& shape, HloInstruction* operand, HloComputation* select,
654 instruction->AppendOperand(operand);
665 const Shape& shape, HloInstruction* operand,
669 instruction->AppendOperand(operand);
677 const Shape& output_shape, HloInstruction* operand,
680 CHECK(ShapeUtil::IsScalar(operand->shape()) ||
681 ShapeUtil::Rank(operand->shape()) == ShapeUtil::Rank(output_shape));
683 output_shape, operand->shape().element_type());
685 if (ShapeUtil::IsScalar(operand->shape())) {
687 HloInstruction::CreateBroadcast(broadcast_shape, operand, {});
688 broadcast->set_metadata(operand->metadata());
689 if (operand->has_sharding()) {
690 broadcast->set_sharding(operand->sharding());
697 for (int i = 0; i < ShapeUtil::Rank(operand->shape()); i++) {
698 if (operand->shape().dimensions(i) == output_shape.dimensions(i)) {
700 reshaped_dimensions.push_back(operand->shape().dimensions(i));
702 CHECK_EQ(operand->shape().dimensions(i), 1)
704 "dimensions to be trivial; operand: "
705 << operand->ToString() << "; output_shape: " << output_shape;
710 ShapeUtil::MakeShape(operand->shape().element_type(),
712 operand));
713 reshaped_operand->set_metadata(operand->metadata());
714 if (operand->has_sharding()) {
715 reshaped_operand->set_sharding(operand->sharding());
720 broadcast->set_metadata(operand->metadata());
721 if (operand->has_sharding()) {
722 broadcast->set_sharding(operand->sharding());
728 const Shape& shape, HloInstruction* operand, HloInstruction* padding_value,
731 instruction->AppendOperand(operand);
738 const Shape& shape, HloInstruction* operand) {
740 ShapeUtil::ElementsIn(operand->shape()))
742 << " operand: " << ShapeUtil::HumanString(operand->shape());
744 instruction->AppendOperand(operand);
749 const Shape& shape, HloInstruction* operand,
752 CHECK_EQ(shape.dimensions().size(), operand->shape().dimensions().size());
753 CHECK(std::equal(operand->shape().dimensions().begin(),
754 operand->shape().dimensions().end(),
757 << ", operand->shape(): " << ShapeUtil::HumanString(shape)
761 instruction->AppendOperand(operand);
794 for (auto operand : operands) {
795 instruction->AppendOperand(operand);
828 // Replace uses of fused parameters with the corresponding operand of the
950 // When add_output is false, instruction_to_fuse is necessarily an operand
952 // Remove the operand from the operand list and remove its corresponding
967 // Remove the corresponding fused parameter and operand from their
991 // Add each operand of the clone as an operand of the fusion instruction. A
996 HloInstruction* operand = clone->mutable_operand(operand_num);
998 // See if this operand is already an operand of the fusion node.
1002 if (operands_[i] == operand) {
1009 // Clone's operand was not already an operand of the fusion
1010 // instruction. Add it as an operand and add a corresponding fused
1012 fused_param = AddFusionOperand(operand);
1116 for (auto operand : operands) {
1117 instruction->AppendOperand(operand);
1128 for (auto operand : operands) {
1129 instruction->AppendOperand(operand);
1140 for (auto operand : operands) {
1141 instruction->AppendOperand(operand);
1159 const Shape& shape, HloInstruction* operand, HloInstruction* gather_indices,
1164 instruction->AppendOperand(operand);
1561 hlo = hlo->operand(0);
1573 hlo = hlo->operand(0);
1610 const HloInstruction* HloInstruction::operand(int64 i) const {
1621 if (target == operand(i)) {
1625 LOG(FATAL) << "target was not an operand: " << target->ToString();
1654 void HloInstruction::AppendOperand(HloInstruction* operand) {
1655 operands_.push_back(operand);
1656 operand->AddUser(this);
1671 for (const HloInstruction* operand : operands_) {
1672 if (operand->IsConstant()) {
1758 // A convert result is determined by the primitive type that the operand is
1911 VLOG(3) << "Replacing operand " << operand_num << " of " << name() << " with "
1952 // An instruction may be repeated as an operand. To avoid calling RemoveUser
1953 // twice on the same operand, keep a set of already detached operands.
1956 HloInstruction* operand = operands_[operand_num];
1957 if (!ContainsKey(detached_operands, operand)) {
1958 operand->RemoveUser(this);
1959 detached_operands.insert(operand);
2087 Join(operands_, ", ", [](string* out, HloInstruction* operand) {
2088 StrAppend(out, ShapeUtil::HumanString(operand->shape()));
2120 // For constants, show the actual value in place of an empty operand list.
2152 operands = Join(slice, ", ", [&](string* out, HloInstruction* operand) {
2155 str.push_back(ShapeUtil::HumanStringWithLayout(operand->shape()));
2158 str.push_back(PrintName(operand->name(), options));
2305 [](string* out, HloInstruction* operand) {
2306 StrAppend(out, "%", operand->name());
2316 for (const HloInstruction* operand : operands_) {
2317 *proto.add_operand_names() = operand->name();
2847 // Verify that the operand of each instruction in the order is also in the
2848 // order *and* the operand's position is earlier (defs are before uses for
2851 for (auto* operand : instruction->operands()) {
2852 if (!ContainsKey(order_position, operand) ||
2853 order_position.at(operand) >= order_position.at(instruction)) {
2927 const HloInstruction* operand) const {
2930 if (this->operand(i) == operand) {
3024 return !ShapeUtil::Equal(shape(), operand(operand_idx)->shape());
3029 const HloInstruction* operand) {
3030 std::vector<int64> operand_indices = instruction->OperandIndices(operand);
3051 // A loop-fusion is elementwise on an operand if all operations (computed
3052 // using BFS) between the operand and the fused root are elementwise.
3058 HloInstruction* operand = worklist.front();
3060 for (HloInstruction* user : operand->users()) {
3066 IsInstructionElementwiseOnOperand(user, operand)) {
3111 ComputeInternal(i, *hlo.operand(j), cache)));
3153 // Reduce reuses the init value but not the operand array elements.
3160 // elements on their left operand.
3162 // elements on their right operand.
3171 // Dynamic-update-slice reuses only operand 2 (start_indices).
3188 return ShapeUtil::InsertedOrDeleted1SizedDimensions(operand(0)->shape_,
3301 // operand. E.g. if batch has dimension number 2, then lhs_dims[2] == "b".
3324 append_dims(lhs_dims, operand(0)->shape());
3326 append_dims(rhs_dims, operand(1)->shape());