reduce_max function in tensorflow












0















Screenshot



>>> boxes = tf.random_normal([ 5])
>>> with s.as_default():
... s.run(boxes)
... s.run(keras.backend.argmax(boxes,axis=0))
... s.run(tf.reduce_max(boxes,axis=0))
...
array([ 0.37312034, -0.97431135, 0.44504794, 0.35789603, 1.2461706 ],
dtype=float32)
3
0.856236


.



Why am I getting 0.8564. I expect the value to be 1.2461. since 1.2461 is big.right?



I am getting correct answer if i use tf.constant.
But I am not getting correct answer while using radom_normal









share|improve this question

























  • Please don't include text as pictures or images.

    – Matias Valdenegro
    Dec 30 '18 at 12:11
















0















Screenshot



>>> boxes = tf.random_normal([ 5])
>>> with s.as_default():
... s.run(boxes)
... s.run(keras.backend.argmax(boxes,axis=0))
... s.run(tf.reduce_max(boxes,axis=0))
...
array([ 0.37312034, -0.97431135, 0.44504794, 0.35789603, 1.2461706 ],
dtype=float32)
3
0.856236


.



Why am I getting 0.8564. I expect the value to be 1.2461. since 1.2461 is big.right?



I am getting correct answer if i use tf.constant.
But I am not getting correct answer while using radom_normal









share|improve this question

























  • Please don't include text as pictures or images.

    – Matias Valdenegro
    Dec 30 '18 at 12:11














0












0








0


0






Screenshot



>>> boxes = tf.random_normal([ 5])
>>> with s.as_default():
... s.run(boxes)
... s.run(keras.backend.argmax(boxes,axis=0))
... s.run(tf.reduce_max(boxes,axis=0))
...
array([ 0.37312034, -0.97431135, 0.44504794, 0.35789603, 1.2461706 ],
dtype=float32)
3
0.856236


.



Why am I getting 0.8564. I expect the value to be 1.2461. since 1.2461 is big.right?



I am getting correct answer if i use tf.constant.
But I am not getting correct answer while using radom_normal









share|improve this question
















Screenshot



>>> boxes = tf.random_normal([ 5])
>>> with s.as_default():
... s.run(boxes)
... s.run(keras.backend.argmax(boxes,axis=0))
... s.run(tf.reduce_max(boxes,axis=0))
...
array([ 0.37312034, -0.97431135, 0.44504794, 0.35789603, 1.2461706 ],
dtype=float32)
3
0.856236


.



Why am I getting 0.8564. I expect the value to be 1.2461. since 1.2461 is big.right?



I am getting correct answer if i use tf.constant.
But I am not getting correct answer while using radom_normal






machine-learning argmax






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 30 '18 at 12:14







Bubesh p

















asked Dec 30 '18 at 11:52









Bubesh pBubesh p

164




164













  • Please don't include text as pictures or images.

    – Matias Valdenegro
    Dec 30 '18 at 12:11



















  • Please don't include text as pictures or images.

    – Matias Valdenegro
    Dec 30 '18 at 12:11

















Please don't include text as pictures or images.

– Matias Valdenegro
Dec 30 '18 at 12:11





Please don't include text as pictures or images.

– Matias Valdenegro
Dec 30 '18 at 12:11












2 Answers
2






active

oldest

votes


















0














Each time a new boxes is regenerated when you run s.run() with radom_normal. So your three results are different. If you want to get consistent results, you should only run s.run() once.



result = s.run([boxes,keras.backend.argmax(boxes,axis=0),tf.reduce_sum(boxes,axis=0)])
print(result[0])
print(result[1])
print(result[2])

#print
[ 0.69957364 1.3192859 -0.6662426 -0.5895929 0.22300807]
1
0.9860319


In addition, the code should be given in text format rather than picture format.






share|improve this answer
























  • Thank you. sorry for image.Actually new to stackoverflow., Now i changed that to text :-)

    – Bubesh p
    Dec 30 '18 at 12:16













  • @Bubeshp It doesn't matter. Welcome to stackoverflow.

    – giser_yugang
    Dec 30 '18 at 12:29



















0














TensorFlow is different from numpy because TF only uses symbolic operations. That means when you instantiate the random_normal, you don't get numeric values, but a symbolic normal distribution, so each time you evaluate it, you get different numbers.



Each time you operate with this distribution, with any other operation, you are getting different numbers, and that explains the results you see.






share|improve this answer
























  • Thank you! Now I understood. Sorry for putting image...Actually new to stackoverflow

    – Bubesh p
    Dec 30 '18 at 12:18











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%2f53977352%2freduce-max-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














Each time a new boxes is regenerated when you run s.run() with radom_normal. So your three results are different. If you want to get consistent results, you should only run s.run() once.



result = s.run([boxes,keras.backend.argmax(boxes,axis=0),tf.reduce_sum(boxes,axis=0)])
print(result[0])
print(result[1])
print(result[2])

#print
[ 0.69957364 1.3192859 -0.6662426 -0.5895929 0.22300807]
1
0.9860319


In addition, the code should be given in text format rather than picture format.






share|improve this answer
























  • Thank you. sorry for image.Actually new to stackoverflow., Now i changed that to text :-)

    – Bubesh p
    Dec 30 '18 at 12:16













  • @Bubeshp It doesn't matter. Welcome to stackoverflow.

    – giser_yugang
    Dec 30 '18 at 12:29
















0














Each time a new boxes is regenerated when you run s.run() with radom_normal. So your three results are different. If you want to get consistent results, you should only run s.run() once.



result = s.run([boxes,keras.backend.argmax(boxes,axis=0),tf.reduce_sum(boxes,axis=0)])
print(result[0])
print(result[1])
print(result[2])

#print
[ 0.69957364 1.3192859 -0.6662426 -0.5895929 0.22300807]
1
0.9860319


In addition, the code should be given in text format rather than picture format.






share|improve this answer
























  • Thank you. sorry for image.Actually new to stackoverflow., Now i changed that to text :-)

    – Bubesh p
    Dec 30 '18 at 12:16













  • @Bubeshp It doesn't matter. Welcome to stackoverflow.

    – giser_yugang
    Dec 30 '18 at 12:29














0












0








0







Each time a new boxes is regenerated when you run s.run() with radom_normal. So your three results are different. If you want to get consistent results, you should only run s.run() once.



result = s.run([boxes,keras.backend.argmax(boxes,axis=0),tf.reduce_sum(boxes,axis=0)])
print(result[0])
print(result[1])
print(result[2])

#print
[ 0.69957364 1.3192859 -0.6662426 -0.5895929 0.22300807]
1
0.9860319


In addition, the code should be given in text format rather than picture format.






share|improve this answer













Each time a new boxes is regenerated when you run s.run() with radom_normal. So your three results are different. If you want to get consistent results, you should only run s.run() once.



result = s.run([boxes,keras.backend.argmax(boxes,axis=0),tf.reduce_sum(boxes,axis=0)])
print(result[0])
print(result[1])
print(result[2])

#print
[ 0.69957364 1.3192859 -0.6662426 -0.5895929 0.22300807]
1
0.9860319


In addition, the code should be given in text format rather than picture format.







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 30 '18 at 12:14









giser_yuganggiser_yugang

1,5931419




1,5931419













  • Thank you. sorry for image.Actually new to stackoverflow., Now i changed that to text :-)

    – Bubesh p
    Dec 30 '18 at 12:16













  • @Bubeshp It doesn't matter. Welcome to stackoverflow.

    – giser_yugang
    Dec 30 '18 at 12:29



















  • Thank you. sorry for image.Actually new to stackoverflow., Now i changed that to text :-)

    – Bubesh p
    Dec 30 '18 at 12:16













  • @Bubeshp It doesn't matter. Welcome to stackoverflow.

    – giser_yugang
    Dec 30 '18 at 12:29

















Thank you. sorry for image.Actually new to stackoverflow., Now i changed that to text :-)

– Bubesh p
Dec 30 '18 at 12:16







Thank you. sorry for image.Actually new to stackoverflow., Now i changed that to text :-)

– Bubesh p
Dec 30 '18 at 12:16















@Bubeshp It doesn't matter. Welcome to stackoverflow.

– giser_yugang
Dec 30 '18 at 12:29





@Bubeshp It doesn't matter. Welcome to stackoverflow.

– giser_yugang
Dec 30 '18 at 12:29













0














TensorFlow is different from numpy because TF only uses symbolic operations. That means when you instantiate the random_normal, you don't get numeric values, but a symbolic normal distribution, so each time you evaluate it, you get different numbers.



Each time you operate with this distribution, with any other operation, you are getting different numbers, and that explains the results you see.






share|improve this answer
























  • Thank you! Now I understood. Sorry for putting image...Actually new to stackoverflow

    – Bubesh p
    Dec 30 '18 at 12:18
















0














TensorFlow is different from numpy because TF only uses symbolic operations. That means when you instantiate the random_normal, you don't get numeric values, but a symbolic normal distribution, so each time you evaluate it, you get different numbers.



Each time you operate with this distribution, with any other operation, you are getting different numbers, and that explains the results you see.






share|improve this answer
























  • Thank you! Now I understood. Sorry for putting image...Actually new to stackoverflow

    – Bubesh p
    Dec 30 '18 at 12:18














0












0








0







TensorFlow is different from numpy because TF only uses symbolic operations. That means when you instantiate the random_normal, you don't get numeric values, but a symbolic normal distribution, so each time you evaluate it, you get different numbers.



Each time you operate with this distribution, with any other operation, you are getting different numbers, and that explains the results you see.






share|improve this answer













TensorFlow is different from numpy because TF only uses symbolic operations. That means when you instantiate the random_normal, you don't get numeric values, but a symbolic normal distribution, so each time you evaluate it, you get different numbers.



Each time you operate with this distribution, with any other operation, you are getting different numbers, and that explains the results you see.







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 30 '18 at 12:15









Matias ValdenegroMatias Valdenegro

31.3k45377




31.3k45377













  • Thank you! Now I understood. Sorry for putting image...Actually new to stackoverflow

    – Bubesh p
    Dec 30 '18 at 12:18



















  • Thank you! Now I understood. Sorry for putting image...Actually new to stackoverflow

    – Bubesh p
    Dec 30 '18 at 12:18

















Thank you! Now I understood. Sorry for putting image...Actually new to stackoverflow

– Bubesh p
Dec 30 '18 at 12:18





Thank you! Now I understood. Sorry for putting image...Actually new to stackoverflow

– Bubesh p
Dec 30 '18 at 12:18


















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%2f53977352%2freduce-max-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

Mossoró

Error while reading .h5 file using the rhdf5 package in R

Pushsharp Apns notification error: 'InvalidToken'