Skip to content

Commit de417b7

Browse files
: python/monarch: pytorch InputBuffer::add() signature changed (#1739)
Summary: pytorch `InputBuffer::add` API changed. adapt `monarch/python/monarch/_gradient_generator.cpp` ``` realInputBuffer(node).add( input_nr, check_and_reduce(node->node, input_nr, std::move(t)), std::nullopt, std::nullopt); // Remove: node->node ``` that gradient computation still works correctly after this change needs to be tested. Reviewed By: vidhyav Differential Revision: D86025607
1 parent fe19d21 commit de417b7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

python/monarch/gradient/_gradient_generator.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,12 +420,20 @@ struct GradientGenerator {
420420
DEBUG_PRINT(
421421
"// add: " << node->node->name()
422422
<< ", input_nr=" << static_cast<int>(input_nr) << "\n");
423+
#if !defined(FBCODE_BUILD)
424+
realInputBuffer(node).add(
425+
input_nr,
426+
check_and_reduce(node->node, input_nr, std::move(t)),
427+
std::nullopt,
428+
std::nullopt);
429+
#else
423430
realInputBuffer(node).add(
424431
input_nr,
425432
check_and_reduce(node->node, input_nr, std::move(t)),
426433
std::nullopt,
427434
std::nullopt,
428435
node->node);
436+
#endif
429437
}
430438

431439
InputBuffer& realInputBuffer(NodeState* state) {

0 commit comments

Comments
 (0)