tvm
random.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
24 #ifndef TVM_RELAY_ATTRS_RANDOM_H_
25 #define TVM_RELAY_ATTRS_RANDOM_H_
26 
27 #include <tvm/ir/attrs.h>
28 
29 namespace tvm {
30 namespace relay {
31 
32 struct ThreefryGenerateAttrs : public tvm::AttrsNode<ThreefryGenerateAttrs> {
34 
35  TVM_DECLARE_ATTRS(ThreefryGenerateAttrs, "relay.attrs.ThreefryGenerateAttrs") {
36  TVM_ATTR_FIELD(out_shape).describe("Shape of random numbers to generate");
37  }
38 };
39 
40 struct UniformAttrs : public tvm::AttrsNode<UniformAttrs> {
43 
44  TVM_DECLARE_ATTRS(UniformAttrs, "relay.attrs.UniformAttrs") {
45  TVM_ATTR_FIELD(out_shape).describe("Shape of random numbers to generate");
47  .set_default(NullValue<DataType>())
48  .describe("Data type of the generated numbers");
49  }
50 };
51 
52 struct NormalAttrs : public tvm::AttrsNode<NormalAttrs> {
55 
56  TVM_DECLARE_ATTRS(NormalAttrs, "relay.attrs.NormalAttrs") {
57  TVM_ATTR_FIELD(out_shape).describe("Shape of random numbers to generate");
59  .set_default(NullValue<DataType>())
60  .describe("Data type of the generated numbers");
61  }
62 };
63 
64 struct MultinomialAttrs : public tvm::AttrsNode<MultinomialAttrs> {
66 
67  TVM_DECLARE_ATTRS(MultinomialAttrs, "relay.attrs.MultinomialAttrs") {
69  .set_default(1)
70  .describe("Number of samples to draw from the distribution.");
71  }
72 };
73 
74 } // namespace relay
75 } // namespace tvm
76 #endif // TVM_RELAY_ATTRS_RANDOM_H_
The base class of the all the Use "curiously recurring template pattern".
Definition: attrs.h:870
Container of constant int that adds more constructors.
Definition: expr.h:632
Array, container representing a contiguous sequence of ObjectRefs.
Definition: array.h:289
Runtime primitive data type.
Definition: data_type.h:43
Helpers for attribute objects.
#define TVM_ATTR_FIELD(FieldName)
Declare an attribute field.
Definition: attrs.h:76
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
DataType NullValue< DataType >()
Definition: attrs.h:90
Definition: random.h:64
Integer num_samples
Definition: random.h:65
TVM_DECLARE_ATTRS(MultinomialAttrs, "relay.attrs.MultinomialAttrs")
Definition: random.h:67
Definition: random.h:52
Array< Integer > out_shape
Definition: random.h:53
DataType out_dtype
Definition: random.h:54
TVM_DECLARE_ATTRS(NormalAttrs, "relay.attrs.NormalAttrs")
Definition: random.h:56
Definition: random.h:32
TVM_DECLARE_ATTRS(ThreefryGenerateAttrs, "relay.attrs.ThreefryGenerateAttrs")
Definition: random.h:35
Array< Integer > out_shape
Definition: random.h:33
Definition: random.h:40
Array< Integer > out_shape
Definition: random.h:41
DataType out_dtype
Definition: random.h:42
TVM_DECLARE_ATTRS(UniformAttrs, "relay.attrs.UniformAttrs")
Definition: random.h:44