How to define loss that can't be expressed by tensors in tensorflow

Qi Cai

For example, x is fed into network A and output y. Then y is used to train a new network B, after B is trained up to a specific iteration, evaluate B on x and output a loss c, the loss c is used as the loss for training network A. In short, I will define a loss that is a trainable network based on the output of previous network. Is there any way to define such loss in tensorflow? Thanks.

kafman

Not sure if this works, but you could try the following: once you computed the loss c, you could feed this value back into network A using a placeholder. Then assign this placeholder to a non-trainable Variable inside model A. This assign operation will then be the "training operation" which you can feed into an optimizer and fetch in the optimization step. If both networks are loaded in the same graph, you probably won't even need the workaround through the placeholder.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Can't get loss to decrease on this tensorflow lstm model

From Dev

How does TensorFlow name tensors?

From Dev

Why the loss function can be apply on different size tensors

From Dev

How can I push tensors to a TensorFlow queue and pull them from another process?

From Dev

How do I zip tensors in tensorflow when the dimensions don't match

From Java

How to use the tensors inside a Keras custom loss function?

From Dev

TensorFlow: How to concatenate tensors by duplicating one of the tensor?

From Dev

How to translate or shift batches of Tensors randomly in Tensorflow

From Dev

How to multiply list of tensors by single tensor on TensorFlow?

From Dev

How Can I Define Only the Gradient for a Tensorflow Subgraph?

From Dev

How does keras define "accuracy" and "loss"?

From Dev

Get values of tensors in loss function

From Dev

Can't define vertices

From Java

How to choose cross-entropy loss in TensorFlow?

From Dev

How to write a custom loss function in Tensorflow?

From Dev

How to choose cross-entropy loss in TensorFlow?

From Dev

How to use sampled_softmax_loss in Tensorflow

From Dev

How to replace some rows in 2-D tensors in Tensorflow

From Dev

how to concatenate multiple 2dim tensors vertically into one in tensorflow?

From Dev

How to duplicate input tensors conditional on a tensor attribute ("oversampling") in a Tensorflow queue?

From Dev

How to convert numerical categorical data into Sparse tensors in tensorflow?

From Dev

How does tensorflow scale RNNCell weight tensors when changing their dimensions?

From Dev

can't find chip define in tensorflow, what templete chip<0>(index) mean?

From Dev

Tensorflow: List of Tensors for Cost

From Dev

TensorFlow print input tensors?

From Dev

how is it possible for shared library to define a function but can't link to it?

From Dev

Can this be expressed in point free style?

From Dev

Can this be expressed in point free style?

From Dev

Tensorflow can't import

Related Related

  1. 1

    Can't get loss to decrease on this tensorflow lstm model

  2. 2

    How does TensorFlow name tensors?

  3. 3

    Why the loss function can be apply on different size tensors

  4. 4

    How can I push tensors to a TensorFlow queue and pull them from another process?

  5. 5

    How do I zip tensors in tensorflow when the dimensions don't match

  6. 6

    How to use the tensors inside a Keras custom loss function?

  7. 7

    TensorFlow: How to concatenate tensors by duplicating one of the tensor?

  8. 8

    How to translate or shift batches of Tensors randomly in Tensorflow

  9. 9

    How to multiply list of tensors by single tensor on TensorFlow?

  10. 10

    How Can I Define Only the Gradient for a Tensorflow Subgraph?

  11. 11

    How does keras define "accuracy" and "loss"?

  12. 12

    Get values of tensors in loss function

  13. 13

    Can't define vertices

  14. 14

    How to choose cross-entropy loss in TensorFlow?

  15. 15

    How to write a custom loss function in Tensorflow?

  16. 16

    How to choose cross-entropy loss in TensorFlow?

  17. 17

    How to use sampled_softmax_loss in Tensorflow

  18. 18

    How to replace some rows in 2-D tensors in Tensorflow

  19. 19

    how to concatenate multiple 2dim tensors vertically into one in tensorflow?

  20. 20

    How to duplicate input tensors conditional on a tensor attribute ("oversampling") in a Tensorflow queue?

  21. 21

    How to convert numerical categorical data into Sparse tensors in tensorflow?

  22. 22

    How does tensorflow scale RNNCell weight tensors when changing their dimensions?

  23. 23

    can't find chip define in tensorflow, what templete chip<0>(index) mean?

  24. 24

    Tensorflow: List of Tensors for Cost

  25. 25

    TensorFlow print input tensors?

  26. 26

    how is it possible for shared library to define a function but can't link to it?

  27. 27

    Can this be expressed in point free style?

  28. 28

    Can this be expressed in point free style?

  29. 29

    Tensorflow can't import

HotTag

Archive