TensorFlow Error. With Rust Failed to start training: InvalidArgument:

I am using rust with TensorFlow and I keep getting this error for this part of the code on the last line nd.finish and I cannot figure out why. Any ideas?

    print!("Setting up TensorFlow disc_optimizer_op operations \n");    
    let disc_optimizer_op = {
        print!("- let mut nd = graph.new_operation \n");
        let mut nd = graph.new_operation("ApplyGradientDescent", "disc_optimizer")?;
        print!("- let learning_rate = 0.001f32 \n");
        let learning_rate = 0.001f32;
        // determine the learning_rate type

        print!("- nd.set_attr_float \n");
        nd.set_attr_float("learning_rate", learning_rate)?;
        print!("- nd.add_input \n");
    
        nd.add_input(disc_loss_op.clone());
        print!("- nd.finish \n");
        let result = nd.finish()?;
        println!("Result from nd.finish(): {:?}", result);
        result
    };

ERROR:

Failed to start training: InvalidArgument: 2 errors while building NodeDef 'disc_optimizer' using Op<name=ApplyGradientDescent; signature=var:Ref(T), alpha:T, delta:T -> out:Ref(T); attr=T:type,allowed=[DT_FLOAT, DT_DOUBLE, DT_INT32, DT_UINT8, DT_INT16, DT_INT8, DT_COMPLEX64, DT_INT64, DT_QINT8, DT_QUINT8, DT_QINT32, DT_BFLOAT16, DT_QINT16, DT_QUINT16, DT_UINT16, DT_COMPLEX128, DT_HALF, DT_UINT32, DT_UINT64]; attr=use_locking:bool,default=false>:
Input 'var' passed float expected ref type
1 inputs specified of 3 inputs in Op

Hi @Bah, Apologies for the delayed response.
The error occurs because ApplyGradientDescent expects three inputs, but your code only provides one. To fix this You need to pass the variable reference as the first input, not the loss.
Thanks!