| 120 | |
| 121 | template <typename TKey, typename TValue, typename TGlobalStep> |
| 122 | void DumpEv(OpKernelContext* context, int variable_index, |
| 123 | const string& tensor_name, BundleWriter& writer) { |
| 124 | EmbeddingVar<TKey, TValue>* variable = nullptr; |
| 125 | OP_REQUIRES_OK(context, |
| 126 | LookupResource(context, |
| 127 | HandleFromInput(context, variable_index), &variable)); |
| 128 | const Tensor& global_step = context->input(3); |
| 129 | TGlobalStep global_step_scalar = global_step.scalar<TGlobalStep>()(); |
| 130 | core::ScopedUnref s(variable); |
| 131 | embedding::ShrinkArgs shrink_args; |
| 132 | shrink_args.global_step = global_step_scalar; |
| 133 | const Tensor& prefix = context->input(0); |
| 134 | const string& prefix_string = prefix.scalar<tstring>()(); |
| 135 | OP_REQUIRES_OK(context, variable->Save(tensor_name, |
| 136 | prefix_string, &writer, shrink_args)); |
| 137 | } |
| 138 | |
| 139 | void Compute(OpKernelContext* context) override { |
| 140 | const Tensor& prefix = context->input(0); |
nothing calls this directly
no test coverage detected