Ejemplo n.º 1
0
SCM tf_set_attr_float(SCM scm_description, SCM scm_name, SCM scm_value)
{
  struct tf_description_t *self = get_tf_description(scm_description);
  char *name = scm_to_locale_string(scm_name);
  TF_SetAttrFloat(self->description, name, (float)scm_to_double(scm_value));
  free(name);
  return SCM_UNDEFINED;
}
// extern void TF_SetAttrFloat(TF_OperationDescription* desc,
//                             const char* attr_name, float value);
static PHP_METHOD(TensorFlow_OperationDescription, setAttrFloat)
{
    zend_string *name;
    double value;

    ZEND_PARSE_PARAMETERS_START(2, 2)
        Z_PARAM_STR(name)
        Z_PARAM_DOUBLE(value)
    ZEND_PARSE_PARAMETERS_END();

    // this
    t_tf_operation_description_object* intern = TF_OPERATION_DESCRIPTION_P_ZV(getThis());
    t_tf_operation_description* node = intern->ptr;

    TF_SetAttrFloat(node->src, name->val, value);
}