Construct a scalar resource.
184361
public static Protos.Resource scalar(String name, String role, double value) {
		checkNotNull(name);
		checkNotNull(role);
		checkNotNull(value);
		return Protos.Resource.newBuilder()
			.setName(name)
			.setType(Protos.Value.Type.SCALAR)
			.setScalar(Protos.Value.Scalar.newBuilder().setValue(value))
			.setRole(role)
			.build();
	}
702946
function scalartyp()
		{
			reset($this->me);
			list($a,)=each($this->me);
			if($a==$GLOBALS['xmlrpcI4'])
			{
				$a=$GLOBALS['xmlrpcInt'];
			}
			return $a;
		}
555727
def scale(self, scalar):
        ''''''
        return self.__class__([self.coefficients[i] * scalar for i in _range(len(self))])
920330
def scalarDecorator(func):
    """"""
    @wraps(func)
    def scalar_wrapper(*args,**kwargs):
        if numpy.array(args[1]).shape == ():
            scalarOut= True
            args= (args[0],numpy.array([args[1]]))
        else:
            scalarOut= False
        result= func(*args,**kwargs)
        if scalarOut:
            return result[0]
        else:
            return result
    return scalar_wrapper
207999
def _zip_with_scalars(args):
  """"""
  zipped = []
  for arg in args:
    if isinstance(arg, prettytensor.PrettyTensor):
      zipped.append(arg if arg.is_sequence() else itertools.repeat(arg))
    elif (isinstance(arg, collections.Sequence) and
          not isinstance(arg, tf.compat.bytes_or_text_types)):
      zipped.append(arg)
    else:
      zipped.append(itertools.repeat(arg))
  assert len(args) == len(zipped)
  return zip(*zipped)
400462
def build(cls: Type[T], data: Generic) -> T:
        """"""
        fields = fields_dict(cls)
        kwargs: Dict[str, Any] = {}
        for key, value in data.items():
            if key in fields:
                if isinstance(value, Mapping):
                    t = fields[key].type
                    if issubclass(t, Auto):
                        value = t.build(value)
                    else:
                        value = Auto.generate(value, name=key.title())
                kwargs[key] = value
            else:
                log.debug(f"got unknown attribute {key} for {cls.__name__}")
        return cls(**kwargs)
1300915
def from_api_repr(cls, resource):
        
        array_type = resource["parameterType"]["arrayType"]["type"]
        if array_type == "STRUCT":
            return cls._from_api_repr_struct(resource)
        return cls._from_api_repr_scalar(resource)
55282
public static Resource createResource(Resource res, short level, short type) {

	boolean asDir = type == TYPE_DIR;
	// File
	if (level >= LEVEL_FILE && res.exists() && ((res.isDirectory() && asDir) || (res.isFile() && !asDir))) {
	    return getCanonicalResourceEL(res);
	}

	// Parent
	Resource parent = res.getParentResource();
	if (level >= LEVEL_PARENT_FILE && parent != null && parent.exists() && canRW(parent)) {
	    if (asDir) {
		if (res.mkdirs()) return getCanonicalResourceEL(res);
	    }
	    else {
		if (createNewResourceEL(res)) return getCanonicalResourceEL(res);
	    }
	    return getCanonicalResourceEL(res);
	}

	// Grand Parent
	if (level >= LEVEL_GRAND_PARENT_FILE && parent != null) {
	    Resource gparent = parent.getParentResource();
	    if (gparent != null && gparent.exists() && canRW(gparent)) {
		if (asDir) {
		    if (res.mkdirs()) return getCanonicalResourceEL(res);
		}
		else {
		    if (parent.mkdirs() && createNewResourceEL(res)) return getCanonicalResourceEL(res);
		}
	    }
	}
	return null;
    }
516417
def to_yaml(cls, representer, node):
        """"""
        return representer.represent_scalar(cls.yaml_tag, node.value)
589384
function resolve_scalar_value(nextql, value, valueQuery, info) {
	if (value == undefined) {
		set(info.result, info.path, null);
		return Promise.resolve();
	}

	if (valueQuery !== 1) {
		const keylen = Object.keys(valueQuery).length;
		const queryAsObject = valueQuery.$params ? keylen > 1 : keylen > 0;
		if (queryAsObject) {
			return Promise.reject(
				new NextQLError("Cannot query scalar as object", info)
			);
		}
	}

	if (isPrimitive(value)) {
		set(info.result, info.path, value);
		return Promise.resolve();
	}

	// non-primitive value as scalar, not good solution yet
	try {
		set(info.result, info.path, JSON.parse(JSON.stringify(value)));
		return Promise.resolve();
	} catch (e) {
		return Promise.reject(
			new NextQLError("Cannot serialize return value", info)
		);
	}
}
980764
def scalars_to_op(cls, ops, kwargs):
    '''
    from qnet.algebra.core.scalar_algebra import is_scalar
    op_ops = []
    for op in ops:
        if is_scalar(op):
            op_ops.append(op * cls._one)
        else:
            op_ops.append(op)
    return op_ops, kwargs
268528
def scalars_impl(self, tag, run, experiment, output_format):
    """"""
    if self._db_connection_provider:
      db = self._db_connection_provider()
      # We select for steps greater than -1 because the writer inserts
      # placeholder rows en masse. The check for step filters out those rows.
      cursor = db.execute('''
        SELECT
          Tensors.step,
          Tensors.computed_time,
          Tensors.data,
          Tensors.dtype
        FROM Tensors
        JOIN Tags
          ON Tensors.series = Tags.tag_id
        JOIN Runs
          ON Tags.run_id = Runs.run_id
        WHERE
          /* For backwards compatibility, ignore the experiment id
             for matching purposes if it is empty. */
          (:exp == '' OR Runs.experiment_id == CAST(:exp AS INT))
          AND Runs.run_name = :run
          AND Tags.tag_name = :tag
          AND Tags.plugin_name = :plugin
          AND Tensors.shape = ''
          AND Tensors.step > -1
        ORDER BY Tensors.step
      ''', dict(exp=experiment, run=run, tag=tag, plugin=metadata.PLUGIN_NAME))
      values = [(wall_time, step, self._get_value(data, dtype_enum))
                for (step, wall_time, data, dtype_enum) in cursor]
    else:
      tensor_events = self._multiplexer.Tensors(run, tag)
      values = [(tensor_event.wall_time,
                 tensor_event.step,
                 tensor_util.make_ndarray(tensor_event.tensor_proto).item())
                for tensor_event in tensor_events]

    if output_format == OutputFormat.CSV:
      string_io = StringIO()
      writer = csv.writer(string_io)
      writer.writerow(['Wall time', 'Step', 'Value'])
      writer.writerows(values)
      return (string_io.getvalue(), 'text/csv')
    else:
      return (values, 'application/json')
1185109
def scalar(cls, value):
    """"""
    return lambda i, name: cls(i, name, (value,), lambda a: a[0], None)
1128196
def create_scalar_summary(name, v):
    
    assert isinstance(name, six.string_types), type(name)
    v = float(v)
    s = tf.Summary()
    s.value.add(tag=name, simple_value=v)
    return s
663170
def p_static_scalar_unary_op(p):
    ''''''
    p[0] = ast.UnaryOp(p[1], p[2], lineno=p.lineno(1))
188
public void scalarMultiply(double c)
    {
        int m = rows;
        int n = cols;
        for (int i = 0; i < m; i++)
        {
            for (int j = 0; j < n; j++)
            {
                consumer.set(i, j, c * supplier.get(i, j));
            }
        }
    }
494038
public function getScalarEiProperty(): ?ScalarEiProperty {
		return new CommonScalarEiProperty($this, null, function ($value) {
			ArgUtils::valScalar($value, true);
			if ($value === null) return null;
			return (int) $value;
		});
	}