Replies: 2 comments
-
When you call >>> 1 - 0.7
0.30000000000000004
>>> eval("1 - 0.7")
0.30000000000000004 I am going to migrate this issue to a discussion as this is not an omegaconf bug. |
Beta Was this translation helpful? Give feedback.
-
@Jasha10 uid: 004
name: split_image_left_right
canvas_width: 1200
canvas_height: 1200
h_safe_padding_ratio: ${sample:0.025,0.6}
w_safe_padding_ratio: ${h_safe_padding_ratio}
layout:
image0:
x: ${select:0,${eval:'1-${layout.image0.width}'}}
y: 1
width: ${select:0.5,0.6,0.7}
height: 1
text0:
x: ${exclude:0,${eval:'1-${layout.image0.width}'},${layout.image0.x}}
y: 1
width: ${eval:'1-${layout.image0.width}'}
height: 1 The correct interpolation sequence, for example, would be:
However, I'm facing a problem. When I register a resolver without using cache, each interpolation is performed individually and does not impact others. Conversely, when I register a resolver with use_cache enabled, all interpolations are identical. I'm looking for a solution to this issue. Is there any way to clear the cache in the resolver, or perhaps another method to address this problem? |
Beta Was this translation helpful? Give feedback.
-
I am using omegaconf to implement some complex logic using a YAML file with interpolation. To achieve this, I registered some new resolvers as follows:
My yaml file looks like this:
However, after resolving the YAML file, the output is not as expected. It seems there is a floating point precision issue, and image0 and text0 are overlapping instead of filling up the image. The resulting output is as follows:
My expected output should look like this:
Beta Was this translation helpful? Give feedback.
All reactions