Crate caffe2op_filler

source ·

Structs

  • | This operator fills the elements of the output | tensor with a constant value specified by the | value argument. | | - The data type is specified by the dtype | argument | | - Currently, the data types supported are f32, | int32, int64, and bool | | - If the dtype argument is not provided, the | data type of value is used | | - The output tensor shape is either specified by | the shape argument or will match the shape of | the input tensor if one is provided (if an input | tensor is provided, a shape argument should not be | set) | | - Optional additional dimensions can be appended | at the end as specified by extra_shape argument | | - If input_as_shape is set to True, the input | should be a 1D tensor containing the desired | output shape (the dimensions specified in | extra_shape will also be appended) | | - If a second input V is passed, fill the output | with the first element of V | | When specifying dtype argument, use the integer | keys from the DataType enum in TensorProto: | | | message TensorProto { | ... | enum DataType { | UNDEFINED = 0; | FLOAT = 1; // float | INT32 = 2; // int | BYTE = 3; // BYTE, when deserialized, is going to be restored as uint8. | STRING = 4; // string | BOOL = 5; // bool | UINT8 = 6; // uint8_t | INT8 = 7; // int8_t | UINT16 = 8; // uint16_t | INT16 = 9; // int16_t | INT64 = 10; // int64_t | FLOAT16 = 12; // at::Half | DOUBLE = 13; // double | } | | | Github Links: | | - https://github.com/pytorch/pytorch/blob/master/caffe2/operators/filler_op.cc
  • | The operator fills the diagonal elements | of the output tensor (>= 2D) with a constant | value specified by the ‘value’ argument, | and others 0. If number of dimensions | of the output tensor is greater than | 2, all dimensions must be equal. | | The data type is specified by the ‘dtype’ | argument. The ‘dtype’ argument must | be one of the data types specified in | the ‘DataType’ enum field in the TensorProto | message. If the ‘dtype’ argument is | not provided, the data type of ‘value’ | is used. | | The output tensor shape is specified | by the ‘shape’ argument. If the number | of input is 1, the shape will be identical | to that of the input at run time with optional | additional dimensions appended at | the end as specified by ‘extra_shape’ | argument. In that case the ‘shape’ argument | should not be set. | | If input_as_shape is set to true, then | the input should be a 1D tensor containing | the desired output shape (the dimensions | specified in extra_shape will also | be appended) | | ———– | @note | | Currently, it supports data type of | float, int32, int64, and bool. |
  • | FillerOp takes in either zero or one | input. | | If the number of input is 1, the shape | will be identical to that of the input | at run time with optional additional | dimensions appended at the end as specified | by “extra_shape” argument. In that | case the “shape” parameter should not | be set. | | If the number of inputs is 0, the full | shape must be provided via “shape” argument |
  • | This op fills an output tensor with samples drawn | from a normal distribution specified by the mean | and standard deviation arguments. The output | tensor shape is specified by the shape argument. | | However, if input_as_shape is set to true, | then the input should be a 1D tensor containing | the desired output shape (the dimensions specified | in extra_shape will also be appended). In this | case, the shape argument should not be set. | | Note: cannot set the shape argument and pass in | an input at the same time. | | Github Links: | - https://github.com/caffe2/caffe2/blob/master/caffe2/operators/filler_op.h | - https://github.com/caffe2/caffe2/blob/master/caffe2/operators/filler_op.cc
  • | This op fills a uint8 output tensor with | the data specified by the value argument. | The data must previously be serialized | as a byte string. The output tensor shape | is specified by the shape argument. | Beware, when using this argument value | should have a value for every element | of the output*, as missing values will | not be initialized automatically. | If input_as_shape is set to true, | then the input should be a 1D tensor | containing the desired output shape | (the dimensions specified in extra_shape | will also be appended). In this case, | the shape argument should not | be set. | | This op allows us to write uint8 tensors | to | | Protobuf as byte strings and read them | back as uint8 tensors in order to avoid | the Protobuf uint32_t varint encoding | size penalty. |
  • | This op fills an output tensor with the | data specified by the value and dtype | arguments. | | The output tensor shape is specified | by the shape* argument. Beware, when | using this argument value* should have | a value for every element of the output, | as missing values will not be initialized | automatically. If input_as_shape | is set to true, then the input should | be a 1D tensor containing the desired | output shape (the dimensions specified | in extra_shape will also be appended). | In this case, the shape argument should | not be set. | | ———– | @note | | Do not set the shape argument and pass | in an input at the same time.* | | Github Links: | | - https://github.com/caffe2/caffe2/blob/master/caffe2/operators/given_tensor_fill_op.h | | - https://github.com/caffe2/caffe2/blob/master/caffe2/operators/given_tensor_fill_op.cc |
  • | The LengthsRangeFill op takes a single | input lengths* and outputs a single | tensor range_sequence*. For each element | of lengths, the op appends the range(0,lengths) | vector to the end of range_sequence. | For example, if input=[2,4,1], the | output would be [0,1,0,1,2,3,0]. | | Github Links: | | - https://github.com/caffe2/caffe2/blob/master/caffe2/operators/filler_op.h | | - https://github.com/caffe2/caffe2/blob/master/caffe2/operators/filler_op.cc |
  • | This is mostly used just as a debugging | purpose stuff: it fills a tensor sequentially | with values 0, 1, 2…, which can then be used | to check e.g. reshape operations by allowing | one to read the indices more easily.
  • | Fill the output tensor with float samples from | uniform distribution [min, max]. | | - The range can be defined either by arguments or | input blobs. min and max are inclusive. | | - If the range is given by input blobs, you | also need to give the shape as input. | | - When the range is given as arguments, this | operator enforces min <= max. When the range is | given as inputs, the constraint is not enforced. | | - When the range is given as inputs and max | < min, the first dimension of the output is set to | 0. This behavior is allowed so that dynamically | sampling indices into a dynamically sized tensor | is possible. | | - The shape of the output can be given as argument | or input. | | Github Links: | - https://github.com/caffe2/caffe2/blob/master/caffe2/operators/filler_op.h | - https://github.com/caffe2/caffe2/blob/master/caffe2/operators/filler_op.cc |
  • | Fill the output tensor with uniform | samples between min and max (inclusive). | | If the second input is given, its elements | will be excluded from uniform sampling. | Using the second input will require | you to provide shape via the first input. |
  • | This op fills an output tensor with values | sampled from a uniform distribution | with the range determined by the desired | shape of the output. | | Rather, than specifying the range of | values manually, the novelty of Xavier | Fill is that it automatically scales | the range of the distribution it draws | from based on the size of the desired | output tensor. | | For more information check out the paper | Understanding the difficulty of training | deep feedforward neural networks. | The output tensor shape is specified | by the shape argument. | | However, if input_as_shape is set | to true, then the input should be | a 1D tensor containing the desired output | shape (the dimensions specified in | extra_shape will also be appended). | In this case, the shape argument should | not be set. | | ———– | @note | | Do not set the shape argument and pass | in an input at the same time.* | | Github Links: | | - https://github.com/caffe2/caffe2/blob/master/caffe2/operators/filler_op.h | | - https://github.com/caffe2/caffe2/blob/master/caffe2/operators/filler_op.cc |

Functions