国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

【Pytorch警告】Using a target size (torch.Size([])) that is different to the input size (torch.Size([1])

這篇具有很好參考價(jià)值的文章主要介紹了【Pytorch警告】Using a target size (torch.Size([])) that is different to the input size (torch.Size([1])。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

我代碼中造成警告的語句是:

value_loss = F.mse_loss(predicted_value, td_value) # predicted_value是預(yù)測(cè)值,td_value是目標(biāo)值,用MSE函數(shù)計(jì)算誤差

原因:mse_loss損失函數(shù)的兩個(gè)輸入Tensor的shape不一致。經(jīng)過reshape或者一些矩陣運(yùn)算以后使得shape一致,不再出現(xiàn)警告了。文章來源地址http://www.zghlxwxcb.cn/news/detail-515278.html

到了這里,關(guān)于【Pytorch警告】Using a target size (torch.Size([])) that is different to the input size (torch.Size([1])的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • ValueError: Expected more than 1 value per channel when training, got input size torch.Size([1, 128]

    因?yàn)橛玫搅薆atchNorm,所以batch_size要大于1,drop_last 參數(shù)設(shè)置為True。 如果是兩個(gè)GPU訓(xùn)練,batch_size改為4。 參考 ValueError: Expected more than 1 value per channel when training, got input size [1, 16, 1, 1](解決方案) Pytorch遇到報(bào)錯(cuò)Expected more than 1 value per channel when training, got input size torch.Size

    2024年01月16日
    瀏覽(26)
  • win_size exceeds image extent. Either ensure that your images are at least 7x7; or pass win_size ex

    win_size exceeds image extent. Either ensure that your images are at least 7x7; or pass win_size ex

    在進(jìn)行超分辨率重建后想計(jì)算SSIM和PSNR,最開始發(fā)現(xiàn)導(dǎo)入compare_psnr,compare_ssim居然報(bào)錯(cuò)了, 上網(wǎng)一查發(fā)現(xiàn)版本更新?lián)Q成了structural_similarity和peak_signal_noise_ratio。 解決 之后又發(fā)現(xiàn)? 好家伙,這么一大段話,我估計(jì) multichannel=True也已經(jīng)不用了,報(bào)錯(cuò)中說 set channel_axis to the axis numb

    2024年02月08日
    瀏覽(19)
  • jenkins執(zhí)行jmeter時(shí),報(bào)Begin size 1 is not equal to fixed size 5

    jenkins執(zhí)行jmeter時(shí),報(bào)Begin size 1 is not equal to fixed size 5

    jenkins執(zhí)行jmeter腳本的時(shí)候一直提示如下錯(cuò)誤: 原因是jenkins版本2.4以上要求的jdk版本11-19,jmeter命令報(bào)告生成需要的jdk版本1.8,屬于jdk的版本兼容問題 解決方法:下載jdk1.8并解壓,然后在jmeter路徑/bin下的jmeter文件中添加jdk路徑

    2024年02月15日
    瀏覽(17)
  • kafka消費(fèi)/發(fā)送消息,消息過大報(bào)錯(cuò)解決whose size is larger than the fetch size 1048576

    kafka消費(fèi)/發(fā)送消息,消息過大報(bào)錯(cuò)解決whose size is larger than the fetch size 1048576

    一、kafka消費(fèi)報(bào)錯(cuò)原因 問題原因一:個(gè)是kafka本身的配置沒有調(diào)整到上限 問題原因二:就是我們自己寫python消費(fèi)kafka代碼的時(shí)候沒有參數(shù)配置沒有限制 RecordTooLargeError: (\\\"There are some messages at [Partition=Offset]: {TopicPartition(topic=\\\'psadad\\\', partition=1): 75} whose size is larger than the fetch size 1

    2024年02月07日
    瀏覽(24)
  • QObject: Cannot create children for a parent that is in a different thread

    在Qt的官方文檔,大家知道有兩種方式使用?QThread。 You can use worker objects by moving them to the thread using QObject::moveToThread(). Another way to make code run in a separate thread, is to subclass QThread and reimplement run(). 在使用MoveToThread這種方式時(shí),經(jīng)常會(huì)遇到下面類似的問題: QObject: Cannot create child

    2024年02月06日
    瀏覽(18)
  • 運(yùn)行錯(cuò)誤:view size is not compatible with input tensor‘s size and stride (at least

    運(yùn)行錯(cuò)誤:view size is not compatible with input tensor‘s size and stride (at least

    python運(yùn)行報(bào)錯(cuò): view size is not compatible with input tensor\\\'s size and stride (at least one dimension spans acros 出現(xiàn)這個(gè)原因主要就是因?yàn)関 iew()需要 Tensor 中的元素地址是連續(xù)的,因?yàn)榭赡艹霈F(xiàn)Tensor不連續(xù)的情況,修改為: 在.view前加 .contiguous() ,使其變?yōu)檫B續(xù)就ok。 ? ?

    2024年02月11日
    瀏覽(18)
  • Pytorch中報(bào)錯(cuò)RuntimeError: The size of tensor a (60) must match the size of tensor b (56)

    Pytorch中報(bào)錯(cuò)RuntimeError: The size of tensor a (60) must match the size of tensor b (56)

    最近在學(xué)習(xí)YOLOV5的時(shí)候,剛開始遇到了如下的問題: 這可能是因?yàn)?.0的工程下載了個(gè)6.1的模型,所以不匹配 yolov5s.pt [https://github.com/ultralytics/yolov5/releases/download/v5.0/yolov5s.pt] 下載下來替換掉工程文件夾里的yolov5s.pt文件 發(fā)現(xiàn)下面這個(gè)問題直接消失了! 順利完成 如果對(duì)你有用麻

    2024年02月01日
    瀏覽(19)
  • Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535.

    Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535.

    新建表或者修改表varchar字段長(zhǎng)度的時(shí)候,出現(xiàn)這個(gè)錯(cuò)誤 大概意思就是行大小太大,不能超過65535 長(zhǎng)度改為21842就正常了,這是為什么? 最終我們執(zhí)行正確的SQL語句 這里的21842長(zhǎng)度是怎么來的? 首先它是什么意思?表示21842字符 首先來了解幾個(gè)規(guī)則,對(duì)我們的字符數(shù)有影響的

    2024年02月05日
    瀏覽(20)
  • 積跬步至千里 || PyTorch 中 shape 和 size 屬性的區(qū)別

    在深度學(xué)習(xí)中,張量 Tensor 和 向量 array 有相似之處,不同的在于 Tensor 兼具了求導(dǎo)的屬性。張量和向量一樣,可以表示多維矩陣,也同樣都有 shape 和 size 屬性。 PyTorch 中 shape 可以計(jì)算出各個(gè)維數(shù)的個(gè)數(shù),即表示多維矩陣的形狀; PyTorch 中 size() 可通過參數(shù)計(jì)算出特定維度上的

    2024年02月12日
    瀏覽(19)
  • RuntimeError: shape ‘[-1, 784]‘ is invalid for input of size 68076

    在應(yīng)用torch進(jìn)行測(cè)試時(shí),有可能出現(xiàn)這種錯(cuò)誤: RuntimeError: shape \\\'[-1, 784]\\\' is invalid for input of size 68076 這個(gè)錯(cuò)誤通常是由于輸入數(shù)據(jù)的大小與模型期望的輸入大小不匹配導(dǎo)致的。具體地說,在這個(gè)錯(cuò)誤信息中, [-1, 784] 表示輸入張量的形狀是一個(gè)二維張量,第一個(gè)維度大小是 -1,

    2024年02月12日
    瀏覽(16)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包