Crate caffe2op_cast

source ·

Structs

  • | Casts the elements of a given input tensor to | a data type specified by the to argument and | returns an output tensor of the same size in the | converted type. | | The to argument must be one of the data types | specified in the DataType enum field in the | TensorProto message (see below). If the to | argument is not provided or is not one of the | enumerated types in DataType, Caffe2 throws an | Enforce error. | | NOTE: Casting from strings is not supported, and | casting to strings is only supported on CPU. | | TensorProto DataType field: | | 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/cast_op.cc |
  • | Some Casts are compatible with gradients, | but for now we don’t support it | | GRADIENT_NOT_IMPLEMENTED_YET(Cast); |