How do I return the value of a tensor from a function in TensorFlow?How do I sort a list of dictionaries by a value of the dictionary?How to randomly select an item from a list?How do I return multiple values from a function?How do I sort a dictionary by value?How to make a chain of function decorators?How to access environment variable values?Tensor indexing in custom loss functionHow to wrap a custom TensorFlow loss function in Keras?Implementing custom loss function in keras with conditionKeras - printing intermediate tensors in loss function (tf.Print and K.print_tensor do not work…)

Discworld quote about an "old couple" who having said everything to each other, can finally go about living their lives

Is ALTER TABLE ... DROP COLUMN really a metadata only operation?

Do the 26 richest billionaires own as much wealth as the poorest 3.8 billion people?

Bin Packing with Relational Penalization

Why wasn't EBCDIC designed with contiguous alphanumeric characters?

How can I deal with extreme temperatures in a hotel room?

How useful would a hydroelectric plant be in the post-apocalypse world?

What is the proper markup for a Math operator in boldface?

Is there a way to convert blue ice back into packed ice?

Can dual citizens open crypto exchange accounts where U.S. citizens are prohibited?

How do I ensure my employees don't abuse my flexible work hours policy?

Does a lens with a bigger max. aperture focus faster than a lens with a smaller max. aperture?

Are Valenar elves and Aereni elves different races of elves?

Story where diplomats use codes for emotions

pgfmath does not work

Could you fall off a planet if it was being accelerated by engines?

Is it okay to submit a paper from a master's thesis without informing the advisor?

Why were the first airplanes "backwards"?

Calculus, Water Poured into a Cone: Why is Derivative Non-linear?

Two palindromes are not enough

Closest Proximity of Oceans to Freshwater Springs

Why wasn't ASCII designed with a contiguous alphanumeric character order?

Having to constantly redo everything because I don't know how to do it?

A quine of sorts



How do I return the value of a tensor from a function in TensorFlow?


How do I sort a list of dictionaries by a value of the dictionary?How to randomly select an item from a list?How do I return multiple values from a function?How do I sort a dictionary by value?How to make a chain of function decorators?How to access environment variable values?Tensor indexing in custom loss functionHow to wrap a custom TensorFlow loss function in Keras?Implementing custom loss function in keras with conditionKeras - printing intermediate tensors in loss function (tf.Print and K.print_tensor do not work…)






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I am working on a deep learning project in Keras, and have implemented a sensitivity function using TensorFlow backend, since that is needed if I want to evaluate a model using it.
However, I cannot extract the value from the tensor. I want to return it, so that I can use the values in other functions. Ideally, the return value should be an int. Whenever I evaluate the function, I just get the tensor object itself, not its real value.



I have tried creating a session and evaluating, but to no avail. I am able to print the value just fine in this way, but I cannot assign the value to another variable.



def calculate_tp(y, y_pred):
TP = 0
FP = 0
TN = 0
FN = 0
for i in range(5):
true = K.equal(y, i)
preds = K.equal(y_pred, i)
TP += K.sum(K.cast(tf.boolean_mask(preds, tf.math.equal(true, True)), 'int32'))
FP += K.sum(K.cast(tf.boolean_mask(true, tf.math.equal(~preds, True)), 'int32'))
TN += K.sum(K.cast(tf.boolean_mask(~preds, tf.math.equal(true, True)), 'int32'))
FN += K.sum(K.cast(tf.boolean_mask(true, tf.math.equal(preds, False)), 'int32'))

"""with tf.Session() as sess:
TP = TP.eval()
FP = FP.eval()
FN = FN.eval()
FP = FP.eval()
print(TP, FP, TN, FN)
#sess.run(FP)"""
return TP / (TP + FN)









share|improve this question






























    0















    I am working on a deep learning project in Keras, and have implemented a sensitivity function using TensorFlow backend, since that is needed if I want to evaluate a model using it.
    However, I cannot extract the value from the tensor. I want to return it, so that I can use the values in other functions. Ideally, the return value should be an int. Whenever I evaluate the function, I just get the tensor object itself, not its real value.



    I have tried creating a session and evaluating, but to no avail. I am able to print the value just fine in this way, but I cannot assign the value to another variable.



    def calculate_tp(y, y_pred):
    TP = 0
    FP = 0
    TN = 0
    FN = 0
    for i in range(5):
    true = K.equal(y, i)
    preds = K.equal(y_pred, i)
    TP += K.sum(K.cast(tf.boolean_mask(preds, tf.math.equal(true, True)), 'int32'))
    FP += K.sum(K.cast(tf.boolean_mask(true, tf.math.equal(~preds, True)), 'int32'))
    TN += K.sum(K.cast(tf.boolean_mask(~preds, tf.math.equal(true, True)), 'int32'))
    FN += K.sum(K.cast(tf.boolean_mask(true, tf.math.equal(preds, False)), 'int32'))

    """with tf.Session() as sess:
    TP = TP.eval()
    FP = FP.eval()
    FN = FN.eval()
    FP = FP.eval()
    print(TP, FP, TN, FN)
    #sess.run(FP)"""
    return TP / (TP + FN)









    share|improve this question


























      0












      0








      0








      I am working on a deep learning project in Keras, and have implemented a sensitivity function using TensorFlow backend, since that is needed if I want to evaluate a model using it.
      However, I cannot extract the value from the tensor. I want to return it, so that I can use the values in other functions. Ideally, the return value should be an int. Whenever I evaluate the function, I just get the tensor object itself, not its real value.



      I have tried creating a session and evaluating, but to no avail. I am able to print the value just fine in this way, but I cannot assign the value to another variable.



      def calculate_tp(y, y_pred):
      TP = 0
      FP = 0
      TN = 0
      FN = 0
      for i in range(5):
      true = K.equal(y, i)
      preds = K.equal(y_pred, i)
      TP += K.sum(K.cast(tf.boolean_mask(preds, tf.math.equal(true, True)), 'int32'))
      FP += K.sum(K.cast(tf.boolean_mask(true, tf.math.equal(~preds, True)), 'int32'))
      TN += K.sum(K.cast(tf.boolean_mask(~preds, tf.math.equal(true, True)), 'int32'))
      FN += K.sum(K.cast(tf.boolean_mask(true, tf.math.equal(preds, False)), 'int32'))

      """with tf.Session() as sess:
      TP = TP.eval()
      FP = FP.eval()
      FN = FN.eval()
      FP = FP.eval()
      print(TP, FP, TN, FN)
      #sess.run(FP)"""
      return TP / (TP + FN)









      share|improve this question
















      I am working on a deep learning project in Keras, and have implemented a sensitivity function using TensorFlow backend, since that is needed if I want to evaluate a model using it.
      However, I cannot extract the value from the tensor. I want to return it, so that I can use the values in other functions. Ideally, the return value should be an int. Whenever I evaluate the function, I just get the tensor object itself, not its real value.



      I have tried creating a session and evaluating, but to no avail. I am able to print the value just fine in this way, but I cannot assign the value to another variable.



      def calculate_tp(y, y_pred):
      TP = 0
      FP = 0
      TN = 0
      FN = 0
      for i in range(5):
      true = K.equal(y, i)
      preds = K.equal(y_pred, i)
      TP += K.sum(K.cast(tf.boolean_mask(preds, tf.math.equal(true, True)), 'int32'))
      FP += K.sum(K.cast(tf.boolean_mask(true, tf.math.equal(~preds, True)), 'int32'))
      TN += K.sum(K.cast(tf.boolean_mask(~preds, tf.math.equal(true, True)), 'int32'))
      FN += K.sum(K.cast(tf.boolean_mask(true, tf.math.equal(preds, False)), 'int32'))

      """with tf.Session() as sess:
      TP = TP.eval()
      FP = FP.eval()
      FN = FN.eval()
      FP = FP.eval()
      print(TP, FP, TN, FN)
      #sess.run(FP)"""
      return TP / (TP + FN)






      python tensorflow keras deep-learning






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 25 at 16:33









      Vlad

      3,6463 gold badges13 silver badges31 bronze badges




      3,6463 gold badges13 silver badges31 bronze badges










      asked Mar 25 at 14:53









      Janus SyrakJanus Syrak

      113 bronze badges




      113 bronze badges






















          2 Answers
          2






          active

          oldest

          votes


















          0














          If I understand well your problem, you can simply create a new tensor with the values
          obtened.



          For example :



          tensor = tf.constant([5, 5, 8, 6, 10, 1, 2])
          tensor_value = tensor.eval(session=tf.Session())
          print(tensor_value) #get [ 5 5 8 6 10 1 2]
          new_tensor = tf.constant(tensor_value)
          print(new_tensor) #get Tensor("Const_25:0", shape=(7,), dtype=int32)


          Hope I helped !






          share|improve this answer























          • I appreciate your answer, but I don't think this is quite what I'm looking for. In the sensitivity function above, ideally I want to return a single number, which is TP / (TP + FN), for example, 0.85. :) Otherwise, I just get 0.0000E+0 for sensitivity when my model compiles.

            – Janus Syrak
            Mar 25 at 16:36



















          0














          Ok so could it be because in your tries TP is always 0 ?



          If i try that :



          y = np.array([0, 0, 0, 0, 0, 1, 1, 1 ,1 ,1])
          y_pred = np.array([0.01, 0.005, 0.5, 0.09, 0.56, 0.999, 0.89, 0.987 ,0.899 ,1])

          def calculate_tp(y, y_pred):
          TP = 0
          FP = 0
          TN = 0
          FN = 0
          for i in range(5):
          true = K.equal(y, i)
          preds = K.equal(y_pred, i)
          TP += K.sum(K.cast(tf.boolean_mask(preds, tf.math.equal(true, True)), 'int32'))
          FP += K.sum(K.cast(tf.boolean_mask(true, tf.math.equal(~preds, True)), 'int32'))
          TN += K.sum(K.cast(tf.boolean_mask(~preds, tf.math.equal(true, True)), 'int32'))
          FN += K.sum(K.cast(tf.boolean_mask(true, tf.math.equal(preds, False)), 'int32'))

          TP = TP.eval(session=tf.Session())
          FP = FP.eval(session=tf.Session())
          TN = TN.eval(session=tf.Session())
          FN = FN.eval(session=tf.Session())
          print(TP, FP, TN, FN)

          results = TP / (TP + FN)

          return results

          res = calculate_tp(y, y_pred)
          print(res)

          #Outputs :
          #0 5 5 5
          #1 9 9 9
          #1 9 9 9
          #1 9 9 9
          #1 9 9 9
          #0.1


          It give me a float number, like you want.



          Is it helping ?






          share|improve this answer























          • You are correct, this does give the correct output. However, I still can't use calculate_tp(y, y_pred) as a metric for compiling my model.

            – Janus Syrak
            Mar 25 at 17:42












          • How are you using it, and what's your errors ?

            – Thibault Bacqueyrisses
            Mar 25 at 18:07













          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55340586%2fhow-do-i-return-the-value-of-a-tensor-from-a-function-in-tensorflow%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          If I understand well your problem, you can simply create a new tensor with the values
          obtened.



          For example :



          tensor = tf.constant([5, 5, 8, 6, 10, 1, 2])
          tensor_value = tensor.eval(session=tf.Session())
          print(tensor_value) #get [ 5 5 8 6 10 1 2]
          new_tensor = tf.constant(tensor_value)
          print(new_tensor) #get Tensor("Const_25:0", shape=(7,), dtype=int32)


          Hope I helped !






          share|improve this answer























          • I appreciate your answer, but I don't think this is quite what I'm looking for. In the sensitivity function above, ideally I want to return a single number, which is TP / (TP + FN), for example, 0.85. :) Otherwise, I just get 0.0000E+0 for sensitivity when my model compiles.

            – Janus Syrak
            Mar 25 at 16:36
















          0














          If I understand well your problem, you can simply create a new tensor with the values
          obtened.



          For example :



          tensor = tf.constant([5, 5, 8, 6, 10, 1, 2])
          tensor_value = tensor.eval(session=tf.Session())
          print(tensor_value) #get [ 5 5 8 6 10 1 2]
          new_tensor = tf.constant(tensor_value)
          print(new_tensor) #get Tensor("Const_25:0", shape=(7,), dtype=int32)


          Hope I helped !






          share|improve this answer























          • I appreciate your answer, but I don't think this is quite what I'm looking for. In the sensitivity function above, ideally I want to return a single number, which is TP / (TP + FN), for example, 0.85. :) Otherwise, I just get 0.0000E+0 for sensitivity when my model compiles.

            – Janus Syrak
            Mar 25 at 16:36














          0












          0








          0







          If I understand well your problem, you can simply create a new tensor with the values
          obtened.



          For example :



          tensor = tf.constant([5, 5, 8, 6, 10, 1, 2])
          tensor_value = tensor.eval(session=tf.Session())
          print(tensor_value) #get [ 5 5 8 6 10 1 2]
          new_tensor = tf.constant(tensor_value)
          print(new_tensor) #get Tensor("Const_25:0", shape=(7,), dtype=int32)


          Hope I helped !






          share|improve this answer













          If I understand well your problem, you can simply create a new tensor with the values
          obtened.



          For example :



          tensor = tf.constant([5, 5, 8, 6, 10, 1, 2])
          tensor_value = tensor.eval(session=tf.Session())
          print(tensor_value) #get [ 5 5 8 6 10 1 2]
          new_tensor = tf.constant(tensor_value)
          print(new_tensor) #get Tensor("Const_25:0", shape=(7,), dtype=int32)


          Hope I helped !







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 25 at 15:53









          Thibault BacqueyrissesThibault Bacqueyrisses

          8891 silver badge13 bronze badges




          8891 silver badge13 bronze badges












          • I appreciate your answer, but I don't think this is quite what I'm looking for. In the sensitivity function above, ideally I want to return a single number, which is TP / (TP + FN), for example, 0.85. :) Otherwise, I just get 0.0000E+0 for sensitivity when my model compiles.

            – Janus Syrak
            Mar 25 at 16:36


















          • I appreciate your answer, but I don't think this is quite what I'm looking for. In the sensitivity function above, ideally I want to return a single number, which is TP / (TP + FN), for example, 0.85. :) Otherwise, I just get 0.0000E+0 for sensitivity when my model compiles.

            – Janus Syrak
            Mar 25 at 16:36

















          I appreciate your answer, but I don't think this is quite what I'm looking for. In the sensitivity function above, ideally I want to return a single number, which is TP / (TP + FN), for example, 0.85. :) Otherwise, I just get 0.0000E+0 for sensitivity when my model compiles.

          – Janus Syrak
          Mar 25 at 16:36






          I appreciate your answer, but I don't think this is quite what I'm looking for. In the sensitivity function above, ideally I want to return a single number, which is TP / (TP + FN), for example, 0.85. :) Otherwise, I just get 0.0000E+0 for sensitivity when my model compiles.

          – Janus Syrak
          Mar 25 at 16:36














          0














          Ok so could it be because in your tries TP is always 0 ?



          If i try that :



          y = np.array([0, 0, 0, 0, 0, 1, 1, 1 ,1 ,1])
          y_pred = np.array([0.01, 0.005, 0.5, 0.09, 0.56, 0.999, 0.89, 0.987 ,0.899 ,1])

          def calculate_tp(y, y_pred):
          TP = 0
          FP = 0
          TN = 0
          FN = 0
          for i in range(5):
          true = K.equal(y, i)
          preds = K.equal(y_pred, i)
          TP += K.sum(K.cast(tf.boolean_mask(preds, tf.math.equal(true, True)), 'int32'))
          FP += K.sum(K.cast(tf.boolean_mask(true, tf.math.equal(~preds, True)), 'int32'))
          TN += K.sum(K.cast(tf.boolean_mask(~preds, tf.math.equal(true, True)), 'int32'))
          FN += K.sum(K.cast(tf.boolean_mask(true, tf.math.equal(preds, False)), 'int32'))

          TP = TP.eval(session=tf.Session())
          FP = FP.eval(session=tf.Session())
          TN = TN.eval(session=tf.Session())
          FN = FN.eval(session=tf.Session())
          print(TP, FP, TN, FN)

          results = TP / (TP + FN)

          return results

          res = calculate_tp(y, y_pred)
          print(res)

          #Outputs :
          #0 5 5 5
          #1 9 9 9
          #1 9 9 9
          #1 9 9 9
          #1 9 9 9
          #0.1


          It give me a float number, like you want.



          Is it helping ?






          share|improve this answer























          • You are correct, this does give the correct output. However, I still can't use calculate_tp(y, y_pred) as a metric for compiling my model.

            – Janus Syrak
            Mar 25 at 17:42












          • How are you using it, and what's your errors ?

            – Thibault Bacqueyrisses
            Mar 25 at 18:07















          0














          Ok so could it be because in your tries TP is always 0 ?



          If i try that :



          y = np.array([0, 0, 0, 0, 0, 1, 1, 1 ,1 ,1])
          y_pred = np.array([0.01, 0.005, 0.5, 0.09, 0.56, 0.999, 0.89, 0.987 ,0.899 ,1])

          def calculate_tp(y, y_pred):
          TP = 0
          FP = 0
          TN = 0
          FN = 0
          for i in range(5):
          true = K.equal(y, i)
          preds = K.equal(y_pred, i)
          TP += K.sum(K.cast(tf.boolean_mask(preds, tf.math.equal(true, True)), 'int32'))
          FP += K.sum(K.cast(tf.boolean_mask(true, tf.math.equal(~preds, True)), 'int32'))
          TN += K.sum(K.cast(tf.boolean_mask(~preds, tf.math.equal(true, True)), 'int32'))
          FN += K.sum(K.cast(tf.boolean_mask(true, tf.math.equal(preds, False)), 'int32'))

          TP = TP.eval(session=tf.Session())
          FP = FP.eval(session=tf.Session())
          TN = TN.eval(session=tf.Session())
          FN = FN.eval(session=tf.Session())
          print(TP, FP, TN, FN)

          results = TP / (TP + FN)

          return results

          res = calculate_tp(y, y_pred)
          print(res)

          #Outputs :
          #0 5 5 5
          #1 9 9 9
          #1 9 9 9
          #1 9 9 9
          #1 9 9 9
          #0.1


          It give me a float number, like you want.



          Is it helping ?






          share|improve this answer























          • You are correct, this does give the correct output. However, I still can't use calculate_tp(y, y_pred) as a metric for compiling my model.

            – Janus Syrak
            Mar 25 at 17:42












          • How are you using it, and what's your errors ?

            – Thibault Bacqueyrisses
            Mar 25 at 18:07













          0












          0








          0







          Ok so could it be because in your tries TP is always 0 ?



          If i try that :



          y = np.array([0, 0, 0, 0, 0, 1, 1, 1 ,1 ,1])
          y_pred = np.array([0.01, 0.005, 0.5, 0.09, 0.56, 0.999, 0.89, 0.987 ,0.899 ,1])

          def calculate_tp(y, y_pred):
          TP = 0
          FP = 0
          TN = 0
          FN = 0
          for i in range(5):
          true = K.equal(y, i)
          preds = K.equal(y_pred, i)
          TP += K.sum(K.cast(tf.boolean_mask(preds, tf.math.equal(true, True)), 'int32'))
          FP += K.sum(K.cast(tf.boolean_mask(true, tf.math.equal(~preds, True)), 'int32'))
          TN += K.sum(K.cast(tf.boolean_mask(~preds, tf.math.equal(true, True)), 'int32'))
          FN += K.sum(K.cast(tf.boolean_mask(true, tf.math.equal(preds, False)), 'int32'))

          TP = TP.eval(session=tf.Session())
          FP = FP.eval(session=tf.Session())
          TN = TN.eval(session=tf.Session())
          FN = FN.eval(session=tf.Session())
          print(TP, FP, TN, FN)

          results = TP / (TP + FN)

          return results

          res = calculate_tp(y, y_pred)
          print(res)

          #Outputs :
          #0 5 5 5
          #1 9 9 9
          #1 9 9 9
          #1 9 9 9
          #1 9 9 9
          #0.1


          It give me a float number, like you want.



          Is it helping ?






          share|improve this answer













          Ok so could it be because in your tries TP is always 0 ?



          If i try that :



          y = np.array([0, 0, 0, 0, 0, 1, 1, 1 ,1 ,1])
          y_pred = np.array([0.01, 0.005, 0.5, 0.09, 0.56, 0.999, 0.89, 0.987 ,0.899 ,1])

          def calculate_tp(y, y_pred):
          TP = 0
          FP = 0
          TN = 0
          FN = 0
          for i in range(5):
          true = K.equal(y, i)
          preds = K.equal(y_pred, i)
          TP += K.sum(K.cast(tf.boolean_mask(preds, tf.math.equal(true, True)), 'int32'))
          FP += K.sum(K.cast(tf.boolean_mask(true, tf.math.equal(~preds, True)), 'int32'))
          TN += K.sum(K.cast(tf.boolean_mask(~preds, tf.math.equal(true, True)), 'int32'))
          FN += K.sum(K.cast(tf.boolean_mask(true, tf.math.equal(preds, False)), 'int32'))

          TP = TP.eval(session=tf.Session())
          FP = FP.eval(session=tf.Session())
          TN = TN.eval(session=tf.Session())
          FN = FN.eval(session=tf.Session())
          print(TP, FP, TN, FN)

          results = TP / (TP + FN)

          return results

          res = calculate_tp(y, y_pred)
          print(res)

          #Outputs :
          #0 5 5 5
          #1 9 9 9
          #1 9 9 9
          #1 9 9 9
          #1 9 9 9
          #0.1


          It give me a float number, like you want.



          Is it helping ?







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 25 at 17:23









          Thibault BacqueyrissesThibault Bacqueyrisses

          8891 silver badge13 bronze badges




          8891 silver badge13 bronze badges












          • You are correct, this does give the correct output. However, I still can't use calculate_tp(y, y_pred) as a metric for compiling my model.

            – Janus Syrak
            Mar 25 at 17:42












          • How are you using it, and what's your errors ?

            – Thibault Bacqueyrisses
            Mar 25 at 18:07

















          • You are correct, this does give the correct output. However, I still can't use calculate_tp(y, y_pred) as a metric for compiling my model.

            – Janus Syrak
            Mar 25 at 17:42












          • How are you using it, and what's your errors ?

            – Thibault Bacqueyrisses
            Mar 25 at 18:07
















          You are correct, this does give the correct output. However, I still can't use calculate_tp(y, y_pred) as a metric for compiling my model.

          – Janus Syrak
          Mar 25 at 17:42






          You are correct, this does give the correct output. However, I still can't use calculate_tp(y, y_pred) as a metric for compiling my model.

          – Janus Syrak
          Mar 25 at 17:42














          How are you using it, and what's your errors ?

          – Thibault Bacqueyrisses
          Mar 25 at 18:07





          How are you using it, and what's your errors ?

          – Thibault Bacqueyrisses
          Mar 25 at 18:07

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55340586%2fhow-do-i-return-the-value-of-a-tensor-from-a-function-in-tensorflow%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript