QUERY客户出口变量的I_STEP解释

本文详细介绍了QUERY中客户出口变量的I_STEP数值及其作用,包括I_STEP=0用于权限检查,I_STEP=1在屏幕打开前赋值,I_STEP=2在屏幕打开后变量赋值,I_STEP=3用于校验变量值。通过理解这些规则,开发者可以更高效地管理和使用变量。

编写QUERY中客户出口变量时需选择I_STEP数值,I_STEP的作用是标识了该调用变量发生的时机,常用的为‘1’、‘2’,解释如下:

 

1) I_STEP = 1: Call is made directly before variable entry.

2) I_STEP = 2: Call is made directly after variable entry. This step is only _executed if the same variable is not input-ready and could not be filled for I_STEP = 1.

3) I_STEP = 3: In this call, you can check the values of the variables. When an exception (RAISE) is triggered, the variable screen appears again. I_STEP = 2 is then also called again.

4) I_STEP = 0: The enhancement is not called from the variable screen. The call can originate from the authorization check or from the monitor.

 

 i_step 分别有哪些值,及使用规则。

I_step = 0 用于权限检查。

I_step = 1 屏幕打开前赋值

I_step = 2 屏幕打开后变量赋值

I_step = 3 校验

f attention(self, query, value, reference_points_cam, weights, proj_mask, spatial_shapes, level_start_index, ): num_query = query.size(1) bs, num_cam, num_value = value.shape[:3] num_all_points = weights.size(-1) slots = torch.zeros_like(query) # (bs, num_query, num_head, num_cam, num_level, num_p) # --> (bs, num_cam, num_query, num_head, num_level, num_p) weights = weights.permute(0, 3, 1, 2, 4, 5).contiguous() # save memory trick, similar as bevformer_occ indexes = [[] for _ in range(bs)] max_len = 0 for i in range(bs): for j in range(num_cam): index_query_per_img = proj_mask[i, j].flatten(1).sum(-1).nonzero().squeeze(-1) indexes[i].append(index_query_per_img) max_len = max(max_len, index_query_per_img.numel()) queries_rebatch = query.new_zeros( [bs, self.num_cams, max_len, self.embed_dims]) reference_points_cam_rebatch = reference_points_cam.new_zeros( [bs, self.num_cams, max_len, self.num_heads, self.num_levels, num_all_points, 2]) weights_rebatch = weights.new_zeros( [bs, self.num_cams, max_len, self.num_heads, self.num_levels, num_all_points]) for i in range(bs): for j in range(num_cam): index_query_per_img = indexes[i][j] curr_numel = index_query_per_img.numel() queries_rebatch[i, j, :curr_numel] = query[i, index_query_per_img] reference_points_cam_rebatch[i, j, :curr_numel] = reference_points_cam[i, j, index_query_per_img] weights_rebatch[i, j, :curr_numel] = weights[i, j, index_query_per_img] value = value.view(bs*num_cam, num_value, self.num_heads, -1) sampling_locations = reference_points_cam_rebatch.view(bs*num_cam, max_len, self.num_heads, self.num_levels, num_all_points, 2) attention_weights = weights_rebatch.reshape(bs*num_cam, max_len, self.num_heads, self.num_levels, num_all_points) if torch.cuda.is_available() and value.is_cuda: output = MultiScaleDeformableAttnFunction_fp32.apply( value, spatial_shapes, level_start_index, sampling_locations, attention_weights, self.im2col_step) else: output = multi_scale_deformable_attn_pytorch( value, spatial_shapes, sampling_locations, attention_weights) output = output.view(bs, num_cam, max_len, -1) for i in range(bs): for j in range(num_cam): index_query_per_img = indexes[i][j] slots[i, index_query_per_img] += output[i, j, :len(index_query_per_img)] return slots
最新发布
04-01
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值