| 134 | |
| 135 | template <class Shape> |
| 136 | Status TensorShapeBase<Shape>::BuildTensorShapeBase( |
| 137 | const TensorShapeProto& proto, TensorShapeBase* out) { |
| 138 | out->set_tag(REP16); |
| 139 | out->set_data_type(DT_INVALID); |
| 140 | // NOTE(irving): Unfortunately, TensorShape allows parsing protos with |
| 141 | // unknown_shape() set, and it seems hard to remove this without backwards |
| 142 | // compatibility issues. |
| 143 | if (kIsPartial && proto.unknown_rank()) { |
| 144 | out->set_ndims_byte(kUnknownRank); |
| 145 | out->set_num_elements(-1); |
| 146 | } else { |
| 147 | out->set_ndims_byte(0); |
| 148 | out->set_num_elements(1); |
| 149 | Status s = Status::OK(); |
| 150 | for (const auto& d : proto.dim()) { |
| 151 | s = out->AddDimWithStatus(d.size()); |
| 152 | if (!s.ok()) { |
| 153 | return s; |
| 154 | } |
| 155 | } |
| 156 | } |
| 157 | return Status::OK(); |
| 158 | } |
| 159 | |
| 160 | template <class Shape> |
| 161 | TensorShapeBase<Shape>::TensorShapeBase(gtl::ArraySlice<int64> dim_sizes) { |
nothing calls this directly
no test coverage detected