| 798 | } |
| 799 | |
| 800 | void TFE_OpSetAttrShapeList(TFE_Op* op, const char* attr_name, |
| 801 | const int64_t** dims, const int* num_dims, |
| 802 | int num_values, TF_Status* out_status) { |
| 803 | std::unique_ptr<tensorflow::TensorShapeProto[]> proto( |
| 804 | new tensorflow::TensorShapeProto[num_values]); |
| 805 | for (int i = 0; i < num_values; ++i) { |
| 806 | const auto num_dims_i = num_dims[i]; |
| 807 | |
| 808 | if (num_dims_i > tensorflow::TensorShape::MaxDimensions()) { |
| 809 | TF_SetStatus(out_status, TF_INVALID_ARGUMENT, |
| 810 | tensorflow::strings::StrCat( |
| 811 | "Value specified for `", attr_name, "` has ", num_dims_i, |
| 812 | " dimensions which is over the limit of ", |
| 813 | tensorflow::TensorShape::MaxDimensions(), ".") |
| 814 | .c_str()); |
| 815 | return; |
| 816 | } |
| 817 | if (num_dims_i < 0) { |
| 818 | proto[i].set_unknown_rank(true); |
| 819 | } else { |
| 820 | const int64_t* dims_i = dims[i]; |
| 821 | auto proto_i = &proto[i]; |
| 822 | for (int d = 0; d < num_dims_i; ++d) { |
| 823 | proto_i->add_dim()->set_size(dims_i[d]); |
| 824 | } |
| 825 | } |
| 826 | } |
| 827 | op->operation.MutableAttrs()->Set( |
| 828 | attr_name, tensorflow::gtl::ArraySlice<tensorflow::TensorShapeProto>( |
| 829 | proto.get(), num_values)); |
| 830 | } |
| 831 | |
| 832 | void TFE_OpSetAttrFunctionList(TFE_Op* op, const char* attr_name, |
| 833 | const TFE_Op** value, int num_values) { |
no test coverage detected