Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

add samplecategorical #1270

Merged
merged 14 commits into from
Mar 31, 2023
Merged

Conversation

enkilee
Copy link
Contributor

@enkilee enkilee commented Mar 16, 2023

Add SampleCategorical function
Function: Randomly sample an integer according to the given distribution.
param1(vector): candidates Candidate set of integers.
param2(vector): probs Probability distribution of candidate integer set.
Return Value(int): Random variables sampled.

@luotao1
Copy link
Collaborator

luotao1 commented Mar 23, 2023

@enkilee 请解决下流水线失败的问题

@enkilee
Copy link
Contributor Author

enkilee commented Mar 25, 2023

@luotao1
ci已都过

Copy link
Collaborator

@CtfGo CtfGo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  Expr SampleCategorical(const std::vector<int>& candidates, const std::vector<float>& probs, const std::vector<int>& decision = {});

参考SamplePerfectTile,增加decision参数可,选值为空或仅包含1个元素,表示先前的sample结果,若decision不为空,则直接以该值作为此次sample结果,以便后续schedule_desc replay时能复现schedule过程。

Copy link
Collaborator

@CtfGo CtfGo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  CheckTracingOutputs(result, trace);
  CheckTracingOutputs(result, ir_sch.GetTraceDesc());
  CheckReplayResult(ir_sch, trace);
  CheckReplayResult(ir_sch, ir_sch.GetTraceDesc());

单测增加校验输出

cinn/backends/ir_schedule_test.cc Show resolved Hide resolved
cinn/ir/ir_schedule.cc Outdated Show resolved Hide resolved
cinn/ir/schedule_desc.cc Outdated Show resolved Hide resolved
cinn/ir/schedule_desc_test.cc Outdated Show resolved Hide resolved
@enkilee
Copy link
Contributor Author

enkilee commented Mar 30, 2023

@CtfGo ci都已过

Copy link
Collaborator

@CtfGo CtfGo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants