Code Monkey home page Code Monkey logo

Comments (1)

HydrogenSulfate avatar HydrogenSulfate commented on June 8, 2024

eval_by_batch函数和keep_batch属性是为了解决FourCastNet评估占用显存过大的问题而设计的,考虑到FourCastNet的样本间相互独立,因此首先为每个batch内的样本计算各自的指标(假设此处单个样本的指标为0-D标量),然后暂不进行reduce操作,从而得到形状为[batch_size, ]的batch_metric,最终把每个batch_metric在第0维拼接在一起,得到形状为[num_samples, ]的full_metric,再做reduce_sum或其他操作,计算整个dataset的指标。

然后看你的报错看起来是手动设置了Metric的keep_batch属性为True,并且metric的计算返回结果是一个标量,所以导致concat([标量,标量, ...])时报错。所以我觉得有可能是因为你的metric.forward函数返回的形状不符合[batch_size,]这一要求。

  1. 可以尝试设置所有metric的keep_batch为False,
  2. 保证metric.forward的返回形状是否是[batch_size,]的形式,参考MAE metric(当然这也许现在看来不一定合理,可以随时在issue里反馈)
  3. 用stack代替concat并不是一个正确的解决方式,因为出错的原因可能并不出在这里

from paddlescience.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.