| 159 | class TensorArrayOp : public TensorArrayCreationOp { |
| 160 | public: |
| 161 | explicit TensorArrayOp(OpKernelConstruction* context) |
| 162 | : TensorArrayCreationOp(context) { |
| 163 | OP_REQUIRES_OK(context, context->GetAttr("dtype", &dtype_)); |
| 164 | OP_REQUIRES_OK(context, context->GetAttr("element_shape", &element_shape_)); |
| 165 | OP_REQUIRES_OK(context, context->GetAttr("dynamic_size", &dynamic_size_)); |
| 166 | // The HasAttr check is for backwards compatibility with older op |
| 167 | // versions which do not have this attribute. |
| 168 | if (context->HasAttr("identical_element_shapes")) { |
| 169 | OP_REQUIRES_OK(context, context->GetAttr("identical_element_shapes", |
| 170 | &identical_element_shapes_)); |
| 171 | } else { |
| 172 | identical_element_shapes_ = false; |
| 173 | } |
| 174 | OP_REQUIRES_OK(context, |
| 175 | context->GetAttr("clear_after_read", &clear_after_read_)); |
| 176 | OP_REQUIRES_OK(context, |
| 177 | context->GetAttr("tensor_array_name", &tensor_array_name_)); |
| 178 | if (tensor_array_name_.empty()) tensor_array_name_ = name(); |
| 179 | } |
| 180 | |
| 181 | Status CreateTensorArray(OpKernelContext* ctx, ResourceMgr* rm, |
| 182 | Tensor* tensor_array_output_handle, |